From patchwork Tue Nov 2 18:25:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516693 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp4862263iml; Tue, 2 Nov 2021 11:27:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwlVGinSztxWRvu7eusBFDCWBnyx43WU4xPMPyZ5N7yEO9ImqXvIuRM5HB2TIlztqKZF10 X-Received: by 2002:a9d:2017:: with SMTP id n23mr28565372ota.215.1635877634629; Tue, 02 Nov 2021 11:27:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635877634; cv=none; d=google.com; s=arc-20160816; b=YOKF2xDtcU3U5dM9HNPAa5KWBj2Esy0cAU7NDqLTvr8yewdiF0dQ4+bwRGQCCxGsei ww/UsKP9ixGB7UKarnvWnk6zUESxaheT8OXbRujaVqxWe9j0pzLzh4vtyrdBiO/kABrF JFWURgjlsMdOPf2eZEJ6a7bwjBhTVxZxLlDeIxtIS1Zupqsu/PzqpP34LXyj4zWUXOwq xUGsT6Q2zT9vTkcruwl/k5xytqUU/dqqfEkIxcYEiW5gbTq7a9kYkwXFCCJ5e29WbP+d 3chBB6qFyjPsJ9FC5+f+8hvWFzcvckFFUZDen/UKawhjEy3SPFbgjj+WbbKdBvBfwHZp 9KyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=R3Zw5SkKkRqQw+OjvhJOUwlZRrn68fgFrPkNLpbWJ7U=; b=LUGqlZa9wRauwM6v67+G/8me74nBZapVRQsIXuwUMMW2ghZfhKBApgwI1J6yIeSuxO 9W8l9wHTVR2K6H5Ws9oALvo/eloNT3ExmT97/dfVzv/pvm1lJXjU9OuumR1sLv//Knvi fDG3goMe/iCJvQb9rF13JHtOxpRdn4VZn7GL5k4OBE1oNsA+5uaf1sSP/VdkLYc85dAy ITVL6oYKqV/47CyxY8KG7Uq/vdeW0OAnt0LJx5Hc4IXx2pw8EwNI+zBT33BrUvBnwNv9 pYo/ICwHqMqUNBF4Ct83Sv0/qJy8TDr6JMLRBJB3w3xuRs4MObmdn8EldXglA0Q2RQNx oyBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=odkByrtO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 97si17655921otj.80.2021.11.02.11.27.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 11:27:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=odkByrtO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhyV7-0005lb-W4 for patch@linaro.org; Tue, 02 Nov 2021 14:27:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38632) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhyTO-0005ff-Hg for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:26 -0400 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]:40685) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhyTK-0004DH-67 for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:26 -0400 Received: by mail-qt1-x830.google.com with SMTP id 19so72135qtt.7 for ; Tue, 02 Nov 2021 11:25:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R3Zw5SkKkRqQw+OjvhJOUwlZRrn68fgFrPkNLpbWJ7U=; b=odkByrtO+GujnQnRAaWYi2rERaYqG/IcvU3jHp28lEGFF8jCehvDGZhN2R3vNgp6kI nvTqI66JxUE8UIXd0wKYqGcPt6Mi5Dkz51xt3INIDy5BuSLRGN3YHW1XMlCh0HuS/0Wj 81TQpOFgXQPqVwtS62qvYqD67LRaoUsU1lfLeqfbh3m9ZCZCgZkCZj856VKnz45B0yYC Uw590mdQvvqvF6AKe+67Prh4pUbqYfe7mYJeBzkjZRQOE4oRT7DbIGcOyLq+cNenoE4S 9GzCSgIW2LiUwsmGhYgUnbTk6O/lod7mcHEe2tE/csOVHilhaNgS85FJgxxp4mKzciFb eNZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R3Zw5SkKkRqQw+OjvhJOUwlZRrn68fgFrPkNLpbWJ7U=; b=TVpSEODXcrkeLPbGHwUJnV8TtjU8PQmVhz5sWpIz6VFbvKk4YQe0gl1l1OJKeiayh6 rITb5Cq8ay0UL62Bb8RC46nZ9JVRtooYL+1lKJ+VGMm7evbj3/0d0OD1pDZMNMEDGugs zsmq0zXJ8GFr7JV8AfxrXqPYeVXSTxhfF84VhJY46ByKcja3d6PcbckVBM1cz+lbMpMc ZRocbSVbXj9sQBvETNfCcAXrL461eSTZBBWt3o1Wtua3Mvv6PPXOUiLKgxIukEEbKVWN 8QNR8FrFxYi9R4pi+8LesOu0e0udI8QHUz1TwCoN7gI0dsC6JryWgzhJJbQ9yPTWKoq2 y1eQ== X-Gm-Message-State: AOAM531h+pJXlhqC2AL0ChJhBnzr6s9pKmkwIzIU2fV29jCSTZhLIHjR zoOLfxKlniPcMclNwrNdub97xEh8DlxwBg== X-Received: by 2002:ac8:18c:: with SMTP id x12mr39520110qtf.378.1635877521363; Tue, 02 Nov 2021 11:25:21 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id y9sm13701081qko.74.2021.11.02.11.25.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 11:25:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v2 01/12] hw/sd: add nuvoton MMC Date: Tue, 2 Nov 2021 14:25:08 -0400 Message-Id: <20211102182519.320319-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102182519.320319-1-richard.henderson@linaro.org> References: <20211102182519.320319-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::830; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x830.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hao Wu , Tyrone Ting , Shengtan Mao , Chris Rauer , Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Shengtan Mao Signed-off-by: Shengtan Mao Signed-off-by: Hao Wu Reviewed-by: Hao Wu Reviewed-by: Chris Rauer Reviewed-by: Tyrone Ting Reviewed-by: Peter Maydell Message-Id: <20211008002628.1958285-2-wuhaotsh@google.com> [rth: Fix typos of "nonexistent"] Signed-off-by: Richard Henderson --- include/hw/sd/npcm7xx_sdhci.h | 65 ++++++++++++ hw/sd/npcm7xx_sdhci.c | 182 ++++++++++++++++++++++++++++++++++ hw/sd/meson.build | 1 + 3 files changed, 248 insertions(+) create mode 100644 include/hw/sd/npcm7xx_sdhci.h create mode 100644 hw/sd/npcm7xx_sdhci.c -- 2.25.1 diff --git a/include/hw/sd/npcm7xx_sdhci.h b/include/hw/sd/npcm7xx_sdhci.h new file mode 100644 index 0000000000..d728f0a40d --- /dev/null +++ b/include/hw/sd/npcm7xx_sdhci.h @@ -0,0 +1,65 @@ +/* + * NPCM7xx SD-3.0 / eMMC-4.51 Host Controller + * + * Copyright (c) 2021 Google LLC + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#ifndef NPCM7XX_SDHCI_H +#define NPCM7XX_SDHCI_H + +#include "hw/sd/sdhci.h" +#include "qom/object.h" + +#define TYPE_NPCM7XX_SDHCI "npcm7xx.sdhci" +#define NPCM7XX_PRSTVALS_SIZE 6 +#define NPCM7XX_PRSTVALS 0x60 +#define NPCM7XX_PRSTVALS_0 0x0 +#define NPCM7XX_PRSTVALS_1 0x2 +#define NPCM7XX_PRSTVALS_2 0x4 +#define NPCM7XX_PRSTVALS_3 0x6 +#define NPCM7XX_PRSTVALS_4 0x8 +#define NPCM7XX_PRSTVALS_5 0xA +#define NPCM7XX_BOOTTOCTRL 0x10 +#define NPCM7XX_SDHCI_REGSIZE 0x20 + +#define NPCM7XX_PRSNTS_RESET 0x04A00000 +#define NPCM7XX_BLKGAP_RESET 0x80 +#define NPCM7XX_CAPAB_RESET 0x0100200161EE0399 +#define NPCM7XX_MAXCURR_RESET 0x0000000000000005 +#define NPCM7XX_HCVER_RESET 0x1002 + +#define NPCM7XX_PRSTVALS_0_RESET 0x0040 +#define NPCM7XX_PRSTVALS_1_RESET 0x0001 +#define NPCM7XX_PRSTVALS_3_RESET 0x0001 + +OBJECT_DECLARE_SIMPLE_TYPE(NPCM7xxSDHCIState, NPCM7XX_SDHCI) + +typedef struct NPCM7xxRegs { + /* Preset Values Register Field, read-only */ + uint16_t prstvals[NPCM7XX_PRSTVALS_SIZE]; + /* Boot Timeout Control Register, read-write */ + uint32_t boottoctrl; +} NPCM7xxRegisters; + +typedef struct NPCM7xxSDHCIState { + SysBusDevice parent; + + MemoryRegion container; + MemoryRegion iomem; + BusState *bus; + NPCM7xxRegisters regs; + + SDHCIState sdhci; +} NPCM7xxSDHCIState; + +#endif /* NPCM7XX_SDHCI_H */ diff --git a/hw/sd/npcm7xx_sdhci.c b/hw/sd/npcm7xx_sdhci.c new file mode 100644 index 0000000000..ef503365df --- /dev/null +++ b/hw/sd/npcm7xx_sdhci.c @@ -0,0 +1,182 @@ +/* + * NPCM7xx SD-3.0 / eMMC-4.51 Host Controller + * + * Copyright (c) 2021 Google LLC + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "qemu/osdep.h" + +#include "hw/sd/npcm7xx_sdhci.h" +#include "migration/vmstate.h" +#include "sdhci-internal.h" +#include "qemu/log.h" + +static uint64_t npcm7xx_sdhci_read(void *opaque, hwaddr addr, unsigned int size) +{ + NPCM7xxSDHCIState *s = opaque; + uint64_t val = 0; + + switch (addr) { + case NPCM7XX_PRSTVALS_0: + case NPCM7XX_PRSTVALS_1: + case NPCM7XX_PRSTVALS_2: + case NPCM7XX_PRSTVALS_3: + case NPCM7XX_PRSTVALS_4: + case NPCM7XX_PRSTVALS_5: + val = s->regs.prstvals[(addr - NPCM7XX_PRSTVALS_0) / 2]; + break; + case NPCM7XX_BOOTTOCTRL: + val = s->regs.boottoctrl; + break; + default: + qemu_log_mask(LOG_GUEST_ERROR, "SDHCI read of nonexistent reg: 0x%02" + HWADDR_PRIx, addr); + break; + } + + return val; +} + +static void npcm7xx_sdhci_write(void *opaque, hwaddr addr, uint64_t val, + unsigned int size) +{ + NPCM7xxSDHCIState *s = opaque; + + switch (addr) { + case NPCM7XX_BOOTTOCTRL: + s->regs.boottoctrl = val; + break; + default: + qemu_log_mask(LOG_GUEST_ERROR, "SDHCI write of nonexistent reg: 0x%02" + HWADDR_PRIx, addr); + break; + } +} + +static bool npcm7xx_sdhci_check_mem_op(void *opaque, hwaddr addr, + unsigned size, bool is_write, + MemTxAttrs attrs) +{ + switch (addr) { + case NPCM7XX_PRSTVALS_0: + case NPCM7XX_PRSTVALS_1: + case NPCM7XX_PRSTVALS_2: + case NPCM7XX_PRSTVALS_3: + case NPCM7XX_PRSTVALS_4: + case NPCM7XX_PRSTVALS_5: + /* RO Word */ + return !is_write && size == 2; + case NPCM7XX_BOOTTOCTRL: + /* R/W Dword */ + return size == 4; + default: + return false; + } +} + +static const MemoryRegionOps npcm7xx_sdhci_ops = { + .read = npcm7xx_sdhci_read, + .write = npcm7xx_sdhci_write, + .endianness = DEVICE_NATIVE_ENDIAN, + .valid = { + .min_access_size = 1, + .max_access_size = 4, + .unaligned = false, + .accepts = npcm7xx_sdhci_check_mem_op, + }, +}; + +static void npcm7xx_sdhci_realize(DeviceState *dev, Error **errp) +{ + NPCM7xxSDHCIState *s = NPCM7XX_SDHCI(dev); + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); + SysBusDevice *sbd_sdhci = SYS_BUS_DEVICE(&s->sdhci); + + memory_region_init(&s->container, OBJECT(s), + "npcm7xx.sdhci-container", 0x1000); + sysbus_init_mmio(sbd, &s->container); + + memory_region_init_io(&s->iomem, OBJECT(s), &npcm7xx_sdhci_ops, s, + TYPE_NPCM7XX_SDHCI, NPCM7XX_SDHCI_REGSIZE); + memory_region_add_subregion_overlap(&s->container, NPCM7XX_PRSTVALS, + &s->iomem, 1); + + sysbus_realize(sbd_sdhci, errp); + memory_region_add_subregion(&s->container, 0, + sysbus_mmio_get_region(sbd_sdhci, 0)); + + /* propagate irq and "sd-bus" from generic-sdhci */ + sysbus_pass_irq(sbd, sbd_sdhci); + s->bus = qdev_get_child_bus(DEVICE(sbd_sdhci), "sd-bus"); + + /* Set the read only preset values. */ + memset(s->regs.prstvals, 0, sizeof(s->regs.prstvals)); + s->regs.prstvals[0] = NPCM7XX_PRSTVALS_0_RESET; + s->regs.prstvals[1] = NPCM7XX_PRSTVALS_1_RESET; + s->regs.prstvals[3] = NPCM7XX_PRSTVALS_3_RESET; +} + +static void npcm7xx_sdhci_reset(DeviceState *dev) +{ + NPCM7xxSDHCIState *s = NPCM7XX_SDHCI(dev); + device_cold_reset(DEVICE(&s->sdhci)); + s->regs.boottoctrl = 0; + + s->sdhci.prnsts = NPCM7XX_PRSNTS_RESET; + s->sdhci.blkgap = NPCM7XX_BLKGAP_RESET; + s->sdhci.capareg = NPCM7XX_CAPAB_RESET; + s->sdhci.maxcurr = NPCM7XX_MAXCURR_RESET; + s->sdhci.version = NPCM7XX_HCVER_RESET; +} + +static const VMStateDescription vmstate_npcm7xx_sdhci = { + .name = TYPE_NPCM7XX_SDHCI, + .version_id = 0, + .fields = (VMStateField[]) { + VMSTATE_UINT32(regs.boottoctrl, NPCM7xxSDHCIState), + VMSTATE_END_OF_LIST(), + }, +}; + +static void npcm7xx_sdhci_class_init(ObjectClass *classp, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(classp); + + dc->desc = "NPCM7xx SD/eMMC Host Controller"; + dc->realize = npcm7xx_sdhci_realize; + dc->reset = npcm7xx_sdhci_reset; + dc->vmsd = &vmstate_npcm7xx_sdhci; +} + +static void npcm7xx_sdhci_instance_init(Object *obj) +{ + NPCM7xxSDHCIState *s = NPCM7XX_SDHCI(obj); + + object_initialize_child(OBJECT(s), "generic-sdhci", &s->sdhci, + TYPE_SYSBUS_SDHCI); +} + +static TypeInfo npcm7xx_sdhci_info = { + .name = TYPE_NPCM7XX_SDHCI, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(NPCM7xxSDHCIState), + .instance_init = npcm7xx_sdhci_instance_init, + .class_init = npcm7xx_sdhci_class_init, +}; + +static void npcm7xx_sdhci_register_types(void) +{ + type_register_static(&npcm7xx_sdhci_info); +} + +type_init(npcm7xx_sdhci_register_types) diff --git a/hw/sd/meson.build b/hw/sd/meson.build index f1ce357a3b..807ca07b7c 100644 --- a/hw/sd/meson.build +++ b/hw/sd/meson.build @@ -9,4 +9,5 @@ softmmu_ss.add(when: 'CONFIG_PXA2XX', if_true: files('pxa2xx_mmci.c')) softmmu_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2835_sdhost.c')) softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_sdhci.c')) softmmu_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-sdhost.c')) +softmmu_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_sdhci.c')) softmmu_ss.add(when: 'CONFIG_CADENCE_SDHCI', if_true: files('cadence_sdhci.c')) From patchwork Tue Nov 2 18:25:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516691 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp4862256iml; Tue, 2 Nov 2021 11:27:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfgJdAkidzOcQsznVWPpfXcnkWfANbJTeD2oYLKmx0TU86UnBDSajjItlb6dW+hbkgTSmI X-Received: by 2002:aca:b846:: with SMTP id i67mr6503219oif.105.1635877634139; Tue, 02 Nov 2021 11:27:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635877634; cv=none; d=google.com; s=arc-20160816; b=v8yZtwAODGXsm4xYwWGZ3noZWItLaJGBte9m+jVceRKLu5E/69jjjG26i+UBql0/hI cjLaMiASWQ4AGaPYljuSCl0OPWkYYneeldpRY9YquF2hTUEytyOXWyM6Fo2H5NC070it CwESEiKOJXdm7vFX7o4QQR7iMjprdwv6y1BX3ZMM9lRDQJ5d2EEPpnSaABzh5gDooE2s tLAwgnWEJWcoKLYzK7fCbpQAhObdC9L04AzlsQzik+sFlFQb9a6b67aTqp8lOY+pc4r+ ueyvRpdHJ67jqx3jQCGx3TWxlQFtwECHQsNupsKF33WUQsXaNQXh4xXXYu1+kVO3SWpm PV7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=XZ8jbPHuutNMQo4+y79myRiaCVlrVDNnYi0kShgMey4=; b=vPxkW/C/XVkNEVt41hDqjGbkgEKDxD1qR4K09wyfPl3uj80lVLtcdGjsEbaw01zWNr Hg63y45LZb8LpcrZbwxU5lGFtyMPs06+9fZmje3BABy1hVUxZSCIQYRCI1//ZdBP1dBI /G3w+JGOvxsfJ/O3uDxqcRRoJYLVjmQiOH0qEWLLFG5oYubch1BfJ2SWVGWlYZqCDJBh bPHuNVSPVx872ye1TzV1H4SsDkdsZiBwP+OG/RVidwApm9iaarqAkbfY09TIQBA3/7d3 JU7Qd6FNQiGUOXbiQvsb7PyRVlWMISRCWFVlcFcEz49nMvGmC4LOerzRIlOgnuEbRt9P KWhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zXoBjf0Z; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c11si8435346oiw.159.2021.11.02.11.27.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 11:27:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zXoBjf0Z; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhyV7-0005kQ-JY for patch@linaro.org; Tue, 02 Nov 2021 14:27:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhyTO-0005fr-UX for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:27 -0400 Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]:46922) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhyTM-0004DR-26 for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:26 -0400 Received: by mail-qk1-x72e.google.com with SMTP id bl12so6235417qkb.13 for ; Tue, 02 Nov 2021 11:25:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XZ8jbPHuutNMQo4+y79myRiaCVlrVDNnYi0kShgMey4=; b=zXoBjf0Zv0Hadizg7WxjlWvcX5Pb2gq6evr8Mi3VJNtVIU0+xTzuUON6/NLuKzH4An KoEHHyU1uvRql+XR09JLbBdl5OuUY+diGoa9jdRMizIarnlwy4TfE8RUvXZbHmVWdHTF BBp88gRdKwCUcYl8c7PTCZUPjieXO5cSKfhbaqZs3eBHTcHJXehmHZQqJa229Odx8s41 yF1oEaJyuMQoSSQb3SZW1c61B+kx7hEaVvW4LAKqDJP5uWGW+DIgEBnX6TpT8TLT8FLc qa5zKuMB5NpSaSCUIJBvBHOZy0HNfk19m8sgXjdEA7oQuoQD1cUN1ze7mkWnPdKoRc+d 2xaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XZ8jbPHuutNMQo4+y79myRiaCVlrVDNnYi0kShgMey4=; b=XLS6c9BM3LGPhADBvXcxNOiOFyaAijz9VAB/LQWQb4xG2dN3Q7EaPPmlwebu8Q/h4q 9WvL/VsOY7w4e39EzOB2HLlPtAUKLBd6GSNI5l2MguZj82vTKg3XgmRoSimzelIs/CSO XYOFcDj8QT+M61ytFu3qJbHINFLZuh3d4s+6sFvlQHlhgSEKWQwRVntoEvrAU5VFP02V ZFupcoQvppM7AvBqGBXQXoeKColpE/KsEvYP/Pl1dMnKHmmF6ga4ksf26uzMM0iBQmL+ rMqKs5I73Fp7WZu9Vn38trsAI0kzmEeDI7HH66zVNFQiSOstEaDWFFqHYYucRCYW1DXF 0vIw== X-Gm-Message-State: AOAM530Af6m4v+C05i4UWhvJLE1TFLMYAjkhhPNYlg6VtWmLf72BPgoE IiukkMnDMqe26bhf0cMCkRq7UyGTfHl3sw== X-Received: by 2002:a05:620a:4550:: with SMTP id u16mr10148328qkp.112.1635877522033; Tue, 02 Nov 2021 11:25:22 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id y9sm13701081qko.74.2021.11.02.11.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 11:25:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v2 02/12] hw/arm: Add Nuvoton SD module to board Date: Tue, 2 Nov 2021 14:25:09 -0400 Message-Id: <20211102182519.320319-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102182519.320319-1-richard.henderson@linaro.org> References: <20211102182519.320319-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72e; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x72e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hao Wu , Tyrone Ting , Shengtan Mao , Chris Rauer , Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Shengtan Mao Signed-off-by: Shengtan Mao Signed-off-by: Hao Wu Reviewed-by: Hao Wu Reviewed-by: Chris Rauer Reviewed-by: Tyrone Ting Reviewed-by: Peter Maydell Message-Id: <20211008002628.1958285-3-wuhaotsh@google.com> Signed-off-by: Richard Henderson --- include/hw/arm/npcm7xx.h | 2 ++ hw/arm/npcm7xx.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/include/hw/arm/npcm7xx.h b/include/hw/arm/npcm7xx.h index 61ecc57ab9..ce593235d9 100644 --- a/include/hw/arm/npcm7xx.h +++ b/include/hw/arm/npcm7xx.h @@ -35,6 +35,7 @@ #include "hw/usb/hcd-ehci.h" #include "hw/usb/hcd-ohci.h" #include "target/arm/cpu.h" +#include "hw/sd/npcm7xx_sdhci.h" #define NPCM7XX_MAX_NUM_CPUS (2) @@ -103,6 +104,7 @@ typedef struct NPCM7xxState { OHCISysBusState ohci; NPCM7xxFIUState fiu[2]; NPCM7xxEMCState emc[2]; + NPCM7xxSDHCIState mmc; } NPCM7xxState; #define TYPE_NPCM7XX "npcm7xx" diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c index 2ab0080e0b..878c2208e0 100644 --- a/hw/arm/npcm7xx.c +++ b/hw/arm/npcm7xx.c @@ -63,6 +63,8 @@ #define NPCM7XX_ROM_BA (0xffff0000) #define NPCM7XX_ROM_SZ (64 * KiB) +/* SDHCI Modules */ +#define NPCM7XX_MMC_BA (0xf0842000) /* Clock configuration values to be fixed up when bypassing bootloader */ @@ -83,6 +85,7 @@ enum NPCM7xxInterrupt { NPCM7XX_UART3_IRQ, NPCM7XX_EMC1RX_IRQ = 15, NPCM7XX_EMC1TX_IRQ, + NPCM7XX_MMC_IRQ = 26, NPCM7XX_TIMER0_IRQ = 32, /* Timer Module 0 */ NPCM7XX_TIMER1_IRQ, NPCM7XX_TIMER2_IRQ, @@ -443,6 +446,8 @@ static void npcm7xx_init(Object *obj) for (i = 0; i < ARRAY_SIZE(s->emc); i++) { object_initialize_child(obj, "emc[*]", &s->emc[i], TYPE_NPCM7XX_EMC); } + + object_initialize_child(obj, "mmc", &s->mmc, TYPE_NPCM7XX_SDHCI); } static void npcm7xx_realize(DeviceState *dev, Error **errp) @@ -707,6 +712,12 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp) &error_abort); memory_region_add_subregion(get_system_memory(), NPCM7XX_ROM_BA, &s->irom); + /* SDHCI */ + sysbus_realize(SYS_BUS_DEVICE(&s->mmc), &error_abort); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->mmc), 0, NPCM7XX_MMC_BA); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->mmc), 0, + npcm7xx_irq(s, NPCM7XX_MMC_IRQ)); + create_unimplemented_device("npcm7xx.shm", 0xc0001000, 4 * KiB); create_unimplemented_device("npcm7xx.vdmx", 0xe0800000, 4 * KiB); create_unimplemented_device("npcm7xx.pcierc", 0xe1000000, 64 * KiB); @@ -736,7 +747,6 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp) create_unimplemented_device("npcm7xx.usbd[8]", 0xf0838000, 4 * KiB); create_unimplemented_device("npcm7xx.usbd[9]", 0xf0839000, 4 * KiB); create_unimplemented_device("npcm7xx.sd", 0xf0840000, 8 * KiB); - create_unimplemented_device("npcm7xx.mmc", 0xf0842000, 8 * KiB); create_unimplemented_device("npcm7xx.pcimbx", 0xf0848000, 512 * KiB); create_unimplemented_device("npcm7xx.aes", 0xf0858000, 4 * KiB); create_unimplemented_device("npcm7xx.des", 0xf0859000, 4 * KiB); From patchwork Tue Nov 2 18:25:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516695 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp4867423iml; Tue, 2 Nov 2021 11:32:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrgLQ/NfAp2vHH4F1ieVhlMfZMoR0TQoXYPtEq3V9IS8Li+6IuaWorEgAAbDM/8p86caJH X-Received: by 2002:a9d:6a4d:: with SMTP id h13mr13373335otn.293.1635877937418; Tue, 02 Nov 2021 11:32:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635877937; cv=none; d=google.com; s=arc-20160816; b=iTOXsjfmYn4LYFETMH0tuvChpAcsw1SNRx04oWVDvu/8ytLVK3lNb4Vuh93hv7bxKL nRn+MggJzgyhY9nEzu17PQ8ktHPwUTVoopX+T0QXIdbYJKJ/sLxGY9X2KSwAjAqlqjXU Rea9AlzwgYkCD5RqxxtZ+Zplqu+B4fEFNsER9z6CWYRunBKtL6NmHBSNt3ZEMF0cBfBT Vb72OwT+NA8cyLtJWgKODTOmGBgR0lC2Q/Y9N0N5LBycsJN+YRRCJoFhWeuJIwuDXrfK 0qU95n83g55JlUahEZuvpm5PjUcaSgk4JO9Ja/u9aReQHxwW1j59LotLQUb4RGg+xNwF Xrig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=CLouTaodPxEP08iPvDZkl4yjeSN0JJ+7RsZ1lYxtnnA=; b=PlRNqv9TCNE+rw423X3vBj70a+FVEEZGwiBMeRgMt9o4o1FoanJSYK1t5+hj+ADxst x4bUNrBJYKFwCp6xWNWYKrha1PpU1Bvfc366z5FkRiMe5zaNzIgSZ6D5AtAyc9SL6kK5 BjO0cbyvQlJiHWqbws7IK/ge9ur1hHxeB9maBJgFkMcpv2pN2xzHUq12GGtx5esKzwqe ZOhHDiMeOmLFyzREEe7D8fJ8IYX/oA/w12UNsHY25C811UE9U6fAfFAT8iw9SNWD1W0P fB6SaEVV5sfKdNvII/4hyvXSSDLVwVGYjp0f/QPfzQCmf+WJCgZkLZtUK4k8j7HIiggs likw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=EkrysGit; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c21si19901582oiw.10.2021.11.02.11.32.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 11:32:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=EkrysGit; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhya0-00031o-Ns for patch@linaro.org; Tue, 02 Nov 2021 14:32:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhyTQ-0005i9-0e for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:28 -0400 Received: from mail-qv1-xf2f.google.com ([2607:f8b0:4864:20::f2f]:45009) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhyTN-0004DT-Hq for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:27 -0400 Received: by mail-qv1-xf2f.google.com with SMTP id v2so13840029qve.11 for ; Tue, 02 Nov 2021 11:25:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CLouTaodPxEP08iPvDZkl4yjeSN0JJ+7RsZ1lYxtnnA=; b=EkrysGitq5Dc6xFTL4fB0OTrYzN2Zf33Ax0D9kw4awVpYf2vx24e7bDzrAnwPOycj2 oSzyPtgET6S0J+K0+MdOdp1snjhn7LApP/XQydez8bA4gJQlTVeD5pUPn9vjSdjruPbo WYRBgUH6RG/riK1jURXouorBvULfwYmOaHqtzpsUwFBCsiN2DU8DVLyR3+npBc1w+YmK founxa93htvWgg4m6rameSPb+fO+peM0VGKQr+Yg6guMJWgOJM1ByaYwVCp/L5l7K5mV EdefqWhgTI3x3YnEKOrAw4A7nJE7rfA3wEFjC5ZRW5l/Hj8KJgFybPHaE4xGxE7UPwHk jpSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CLouTaodPxEP08iPvDZkl4yjeSN0JJ+7RsZ1lYxtnnA=; b=zMgnet9DQed4KnD+yqWSZbXxH085PIorPZklCp/aWeeGgEFyy6THWXVPL3HwOW7OEL fx3DvmXaRinKRTEnQ0fxeRdmx6rllKV+wI+FAMCoFT928oDtrJiFhE6lnsv3kUdpgJ/t oS2VcbD5k533faoA6xmeb0gUEo22C1/GT7BfCpBNA2joSFIficJ3YK2DPY9p2Bc/+5zI MomZRN33E8N2HsXvpvgDenDYfGR8jTTCyACNavwX2Pgr0snYko2BT7schDJgbVcA8GoC rGUOyCu9ZabtBkQU11BRulOdYz6TQOuiItzp5Ia1rRzIDJ5xszI3Dpr77a13ogxL06pi 4wBw== X-Gm-Message-State: AOAM531FPDktr1FhPR8Oj7hO2Fuvp2JL3bAFeEfR+PzVo1hybhho31D9 gIeDIguLYSmkehYD3PQyV4R3hKYnNM7vWw== X-Received: by 2002:a05:6214:e41:: with SMTP id o1mr37483193qvc.0.1635877522649; Tue, 02 Nov 2021 11:25:22 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id y9sm13701081qko.74.2021.11.02.11.25.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 11:25:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v2 03/12] hw/arm: Attach MMC to quanta-gbs-bmc Date: Tue, 2 Nov 2021 14:25:10 -0400 Message-Id: <20211102182519.320319-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102182519.320319-1-richard.henderson@linaro.org> References: <20211102182519.320319-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f2f; envelope-from=richard.henderson@linaro.org; helo=mail-qv1-xf2f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hao Wu , Tyrone Ting , Shengtan Mao , Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Shengtan Mao Signed-off-by: Shengtan Mao Signed-off-by: Hao Wu Reviewed-by: Hao Wu Reviewed-by: Tyrone Ting Reviewed-by: Peter Maydell Message-Id: <20211008002628.1958285-4-wuhaotsh@google.com> Signed-off-by: Richard Henderson --- hw/arm/npcm7xx_boards.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.25.1 diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index a656169f61..dec7d16ae5 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -27,6 +27,9 @@ #include "qemu-common.h" #include "qemu/datadir.h" #include "qemu/units.h" +#include "sysemu/blockdev.h" +#include "sysemu/sysemu.h" +#include "sysemu/block-backend.h" #define NPCM750_EVB_POWER_ON_STRAPS 0x00001ff7 #define QUANTA_GSJ_POWER_ON_STRAPS 0x00001fff @@ -81,6 +84,22 @@ static void npcm7xx_connect_dram(NPCM7xxState *soc, MemoryRegion *dram) &error_abort); } +static void sdhci_attach_drive(SDHCIState *sdhci) +{ + DriveInfo *di = drive_get_next(IF_SD); + BlockBackend *blk = di ? blk_by_legacy_dinfo(di) : NULL; + + BusState *bus = qdev_get_child_bus(DEVICE(sdhci), "sd-bus"); + if (bus == NULL) { + error_report("No SD bus found in SOC object"); + exit(1); + } + + DeviceState *carddev = qdev_new(TYPE_SD_CARD); + qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal); + qdev_realize_and_unref(carddev, bus, &error_fatal); +} + static NPCM7xxState *npcm7xx_create_soc(MachineState *machine, uint32_t hw_straps) { @@ -355,6 +374,7 @@ static void quanta_gbs_init(MachineState *machine) drive_get(IF_MTD, 0, 0)); quanta_gbs_i2c_init(soc); + sdhci_attach_drive(&soc->mmc.sdhci); npcm7xx_load_kernel(machine, soc); } From patchwork Tue Nov 2 18:25:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516699 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp4873187iml; Tue, 2 Nov 2021 11:37:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4SdDh1OmtfQzP5Xa0xl9+HcOK0/OEZgthBU/og1mQvvesKaJ0JUcP/AcbDrJQ69HXa4/D X-Received: by 2002:a05:6808:118c:: with SMTP id j12mr6306625oil.65.1635878268546; Tue, 02 Nov 2021 11:37:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635878268; cv=none; d=google.com; s=arc-20160816; b=FZPNTHNMauWBv1w1yWRmHiyQt0USzht9+IefV4nK7WNUKJGMLWaMBm7wseSWe+VW4j zjJhuS+L80tYneyFbYOlHWzWYhi6G8SrtCTM70Hze/rH+3UP1GOcYeKBBN3TaLLWQ5bp H7a946gSNOO9MuwESLy8ZEBaoVuNrIrjsftJHid87w+zgV0qoDeE6JHpv1Y2hAiD5uM6 5aF5gnVlaLcBzYQ493zyG2J0sNhZcvqU330SKW6YKaOvfhgzJayOBnWE7qyct/UPWwpf HSWNEqu+y7uiMOsY94xxuYlhpEHl/TB2FcIWKGDtmZPKcaYFNMXJUlWG51nP8iLT5WVl JpWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=5olNar/voJxctGgKV5rYLhEwaLGt/m101tgdSsLT0J8=; b=e9Fdpz6/Yyi2oiDq4VFPn9AC4ZW8JEU2WB5YohUpmaowgl7Wa1o6BiLiTZdWrhlSi0 sriDKh6hQMcj/XiYxDntoO3PTOIcUoKDLSDtkN8mqKJj3wpCV/fItjZnF9UxVo1fHWjN yOCgQjPeAKZIlgwf38jUOOgfgWnMYj5BzS5sdWcb5NHDDVGbQSV1y/i3Y3IjRseKvrgV ux+BXkUsidwafguPjhLRVROxEXRJMuQR936FMGl638tvImFpp2P58fEMI2S7msOY4mq1 XpzxwUaYyCC6k6z2tQgXNDBLIJlDqUC1uqBv28X44HdAe8aAnz158LpXulMWAo6JLuit 43Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GyBPAdqd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g16si3747349otn.297.2021.11.02.11.37.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 11:37:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GyBPAdqd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhyfL-0000Sa-Vu for patch@linaro.org; Tue, 02 Nov 2021 14:37:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38712) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhyTQ-0005kV-Vh for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:28 -0400 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]:35662) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhyTM-0004DU-Ql for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:28 -0400 Received: by mail-qk1-x72c.google.com with SMTP id az8so9337548qkb.2 for ; Tue, 02 Nov 2021 11:25:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5olNar/voJxctGgKV5rYLhEwaLGt/m101tgdSsLT0J8=; b=GyBPAdqd6OEMrnU5nov4pJWyLdfMjv7sQwOlaRC6Dr7nbhrTDrWii2Qng+8kFX7lq4 c38+355h00nOX3q/O84+7bQk84oXndJ4kMOonkoNPqT1UdVvwlznwPL0JdjiVp4P6VVH 48FiFfAfwTj/u+ZIYydipstxkT+MH5/n4cHADe3IYCUdNRTs/u8RBcQVKdhoeJCFNCVL f++nFV6uJ04D/itI0DKprQ8JYtbVfPlcHuhATYXP5IEWlDQ5AoeCHlJ6b8Cd6yg4k37C R5rE7xkz9cskiZ0FGHoL2s9ZTQQTndwMwN9SJu/zQkij6jT6N44TPiDRLxDl8zLzwiiX DN2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5olNar/voJxctGgKV5rYLhEwaLGt/m101tgdSsLT0J8=; b=fTORKn9771zAClaIb6KeHuSznzsiKStR7F+gASnlfYyK6XpvLgYGbuNq14kdPlp7HW jT6g1dvuHfge1EgyDAB/Zex7B0aVvfYIxBG9sqDYwLFoEFETa/C/mYOuVEuU95kULLZ6 igwf7A+z1h0eDtnLzh9S24zJ8af45mWBWc/YUbEsNLCXhKD4YRWD0kXoSVJMjcgjLlse kTkORFST4hbjOWuoWwDijW7sDxBMxmg5RoRVpDGtQnHvw4aW8lEhNMU55aj56sEtBIrv xbdjanYCYLf0Uz71hkdJjeJnE1b3GyPTYsJjMFcqtneecmnUWmR0lLXIiDkBgkKpv4O3 sjEA== X-Gm-Message-State: AOAM531hbxi7qEudGRWRT3qFFD3i1L6ScChfYjjzQExdp1YQ2y0MeM/R Euz6ysPKXsn5naXQAN0hKH4wktlQRnYXWQ== X-Received: by 2002:a05:620a:2442:: with SMTP id h2mr31608865qkn.298.1635877523380; Tue, 02 Nov 2021 11:25:23 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id y9sm13701081qko.74.2021.11.02.11.25.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 11:25:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v2 04/12] tests/qtest/libqos: add SDHCI commands Date: Tue, 2 Nov 2021 14:25:11 -0400 Message-Id: <20211102182519.320319-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102182519.320319-1-richard.henderson@linaro.org> References: <20211102182519.320319-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72c; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x72c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hao Wu , Tyrone Ting , Shengtan Mao , Chris Rauer , Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Shengtan Mao Signed-off-by: Shengtan Mao Signed-off-by: Hao Wu Reviewed-by: Hao Wu Reviewed-by: Chris Rauer Reviewed-by: Tyrone Ting Reviewed-by: Peter Maydell Message-Id: <20211008002628.1958285-5-wuhaotsh@google.com> Signed-off-by: Richard Henderson --- tests/qtest/libqos/sdhci-cmd.h | 70 ++++++++++++++++++++ tests/qtest/libqos/sdhci-cmd.c | 116 +++++++++++++++++++++++++++++++++ tests/qtest/libqos/meson.build | 1 + 3 files changed, 187 insertions(+) create mode 100644 tests/qtest/libqos/sdhci-cmd.h create mode 100644 tests/qtest/libqos/sdhci-cmd.c -- 2.25.1 Signed-off-by: Shengtan Mao <stmao@google.com>
Signed-off-by: Hao Wu <wuhaotsh@google.com>
Reviewed-by: Hao Wu <wuhaotsh@google.com>
Reviewed-by: Chris Rauer <crauer@google.com>
Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
diff --git a/tests/qtest/libqos/sdhci-cmd.h b/tests/qtest/libqos/sdhci-cmd.h new file mode 100644 index 0000000000..64763c5a2a --- /dev/null +++ b/tests/qtest/libqos/sdhci-cmd.h @@ -0,0 +1,70 @@ +/* + * MMC Host Controller Commands + * + * Copyright (c) 2021 Google LLC + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "libqtest.h" + +/* more details at hw/sd/sdhci-internal.h */ +#define SDHC_BLKSIZE 0x04 +#define SDHC_BLKCNT 0x06 +#define SDHC_ARGUMENT 0x08 +#define SDHC_TRNMOD 0x0C +#define SDHC_CMDREG 0x0E +#define SDHC_BDATA 0x20 +#define SDHC_PRNSTS 0x24 +#define SDHC_BLKGAP 0x2A +#define SDHC_CLKCON 0x2C +#define SDHC_SWRST 0x2F +#define SDHC_CAPAB 0x40 +#define SDHC_MAXCURR 0x48 +#define SDHC_HCVER 0xFE + +/* TRNSMOD Reg */ +#define SDHC_TRNS_BLK_CNT_EN 0x0002 +#define SDHC_TRNS_READ 0x0010 +#define SDHC_TRNS_WRITE 0x0000 +#define SDHC_TRNS_MULTI 0x0020 + +/* CMD Reg */ +#define SDHC_CMD_DATA_PRESENT (1 << 5) +#define SDHC_ALL_SEND_CID (2 << 8) +#define SDHC_SEND_RELATIVE_ADDR (3 << 8) +#define SDHC_SELECT_DESELECT_CARD (7 << 8) +#define SDHC_SEND_CSD (9 << 8) +#define SDHC_STOP_TRANSMISSION (12 << 8) +#define SDHC_READ_MULTIPLE_BLOCK (18 << 8) +#define SDHC_WRITE_MULTIPLE_BLOCK (25 << 8) +#define SDHC_APP_CMD (55 << 8) + +/* SWRST Reg */ +#define SDHC_RESET_ALL 0x01 + +/* CLKCTRL Reg */ +#define SDHC_CLOCK_INT_EN 0x0001 +#define SDHC_CLOCK_INT_STABLE 0x0002 +#define SDHC_CLOCK_SDCLK_EN (1 << 2) + +/* Set registers needed to send commands to SD */ +void sdhci_cmd_regs(QTestState *qts, uint64_t base_addr, uint16_t blksize, + uint16_t blkcnt, uint32_t argument, uint16_t trnmod, + uint16_t cmdreg); + +/* Read at most 1 block of SD using non-DMA */ +ssize_t sdhci_read_cmd(QTestState *qts, uint64_t base_addr, char *msg, + size_t count); + +/* Write at most 1 block of SD using non-DMA */ +void sdhci_write_cmd(QTestState *qts, uint64_t base_addr, const char *msg, + size_t count, size_t blksize); diff --git a/tests/qtest/libqos/sdhci-cmd.c b/tests/qtest/libqos/sdhci-cmd.c new file mode 100644 index 0000000000..2d9e518341 --- /dev/null +++ b/tests/qtest/libqos/sdhci-cmd.c @@ -0,0 +1,116 @@ +/* + * MMC Host Controller Commands + * + * Copyright (c) 2021 Google LLC + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "qemu/osdep.h" +#include "sdhci-cmd.h" +#include "libqtest.h" + +static ssize_t read_fifo(QTestState *qts, uint64_t reg, char *msg, size_t count) +{ + uint32_t mask = 0xff; + size_t index = 0; + uint32_t msg_frag; + int size; + while (index < count) { + size = count - index; + if (size > 4) { + size = 4; + } + msg_frag = qtest_readl(qts, reg); + while (size > 0) { + msg[index] = msg_frag & mask; + if (msg[index++] == 0) { + return index; + } + msg_frag >>= 8; + --size; + } + } + return index; +} + +static void write_fifo(QTestState *qts, uint64_t reg, const char *msg, + size_t count) +{ + size_t index = 0; + uint32_t msg_frag; + int size; + int frag_i; + while (index < count) { + size = count - index; + if (size > 4) { + size = 4; + } + msg_frag = 0; + frag_i = 0; + while (frag_i < size) { + msg_frag |= ((uint32_t)msg[index++]) << (frag_i * 8); + ++frag_i; + } + qtest_writel(qts, reg, msg_frag); + } +} + +static void fill_block(QTestState *qts, uint64_t reg, int count) +{ + while (--count >= 0) { + qtest_writel(qts, reg, 0); + } +} + +void sdhci_cmd_regs(QTestState *qts, uint64_t base_addr, uint16_t blksize, + uint16_t blkcnt, uint32_t argument, uint16_t trnmod, + uint16_t cmdreg) +{ + qtest_writew(qts, base_addr + SDHC_BLKSIZE, blksize); + qtest_writew(qts, base_addr + SDHC_BLKCNT, blkcnt); + qtest_writel(qts, base_addr + SDHC_ARGUMENT, argument); + qtest_writew(qts, base_addr + SDHC_TRNMOD, trnmod); + qtest_writew(qts, base_addr + SDHC_CMDREG, cmdreg); +} + +ssize_t sdhci_read_cmd(QTestState *qts, uint64_t base_addr, char *msg, + size_t count) +{ + sdhci_cmd_regs(qts, base_addr, count, 1, 0, + SDHC_TRNS_MULTI | SDHC_TRNS_READ | SDHC_TRNS_BLK_CNT_EN, + SDHC_READ_MULTIPLE_BLOCK | SDHC_CMD_DATA_PRESENT); + + /* read sd fifo_buffer */ + ssize_t bytes_read = read_fifo(qts, base_addr + SDHC_BDATA, msg, count); + + sdhci_cmd_regs(qts, base_addr, 0, 0, 0, + SDHC_TRNS_MULTI | SDHC_TRNS_READ | SDHC_TRNS_BLK_CNT_EN, + SDHC_STOP_TRANSMISSION); + + return bytes_read; +} + +void sdhci_write_cmd(QTestState *qts, uint64_t base_addr, const char *msg, + size_t count, size_t blksize) +{ + sdhci_cmd_regs(qts, base_addr, blksize, 1, 0, + SDHC_TRNS_MULTI | SDHC_TRNS_WRITE | SDHC_TRNS_BLK_CNT_EN, + SDHC_WRITE_MULTIPLE_BLOCK | SDHC_CMD_DATA_PRESENT); + + /* write to sd fifo_buffer */ + write_fifo(qts, base_addr + SDHC_BDATA, msg, count); + fill_block(qts, base_addr + SDHC_BDATA, (blksize - count) / 4); + + sdhci_cmd_regs(qts, base_addr, 0, 0, 0, + SDHC_TRNS_MULTI | SDHC_TRNS_WRITE | SDHC_TRNS_BLK_CNT_EN, + SDHC_STOP_TRANSMISSION); +} diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build index 1f5c8f1053..4af1f04787 100644 --- a/tests/qtest/libqos/meson.build +++ b/tests/qtest/libqos/meson.build @@ -5,6 +5,7 @@ libqos_srcs = files('../libqtest.c', 'fw_cfg.c', 'malloc.c', 'libqos.c', + 'sdhci-cmd.c', # spapr 'malloc-spapr.c', From patchwork Tue Nov 2 18:25:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516697 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp4870280iml; Tue, 2 Nov 2021 11:35:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6L836SehCqp9LfUzWK73KTB0ifyvkoEZJetq6TCmnMyTWAosgd+pT/kiRXO4h26hRsrnv X-Received: by 2002:a05:6830:43aa:: with SMTP id s42mr10413415otv.13.1635878099909; Tue, 02 Nov 2021 11:34:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635878099; cv=none; d=google.com; s=arc-20160816; b=KSPyHaPXHwdl5qPlsi/uAIoMt/Hs2pOeBo8eNdVi0rYRA+b8K8rh3HExzdN/audG0E 79MpoV8Lfx8g8Gb2EFNikDf/Xzf3sYS8og70MHDFDn3hF4htN9BoHen30YzOB7QMBCmd E618rm2SWTg8KW1mGgynZP16CzxGyKazqY5McGhtx0jLpjfTRdI/4Hd7mqnJ3iyuL98s RHJJ10TKRrUEwZFcij4GfKdESD8FPZmq28aq+Ed9/iJobCVO4+JbNfMillxVVbGELaJ1 aDV+vnHkL26IBjDy1CLKbqkphij4UCLEfutWh5sNdRiBGLMhZYKj/pea83acz7NhwF0+ 7ijA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=4iN+wCNn39PyCmqyIu9fXyF1t2chc7mKLTiK8TWZaXs=; b=ZggA5vnxWTF06WJUw84seDAk6a6kg5Fg9qEb9ZxD3EQykHyIFyVV4S2fo/R8V72DF3 s1e98JuK4zoJfsRorm/IHVRRA55Z17cgB2NEHflkw4LozT7wW75+F4pjme0+4KF2+syn sjdHdBqdqyXhCh0Wgook+J56RdwZjA4Ht3dc2V2JP6RDpIP4BAuTBmqRvzEWTymZ6kU+ qJ8jdFMq/FFV6PiFIz3UlH8FHdH5YLFyIgmpWQY1GfCVLLs/B0VEA6Y5YdzY9FcosoXx VIeNREIOFSWdizHivDzT5vfHBEG1XWCTYE47zLyFt8Jgtac1zdOaGnmlmQo4dU/PC0p4 Btlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JoPCVBn9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v4si5060061oth.276.2021.11.02.11.34.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 11:34:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JoPCVBn9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhycd-0005vR-Bt for patch@linaro.org; Tue, 02 Nov 2021 14:34:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhyTO-0005gE-Se for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:26 -0400 Received: from mail-qv1-xf33.google.com ([2607:f8b0:4864:20::f33]:35508) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhyTM-0004Dc-Tc for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:26 -0400 Received: by mail-qv1-xf33.google.com with SMTP id u25so13891786qve.2 for ; Tue, 02 Nov 2021 11:25:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4iN+wCNn39PyCmqyIu9fXyF1t2chc7mKLTiK8TWZaXs=; b=JoPCVBn9L1Ue22zkRBO/EyAKTn1xiZ8Z9+zAHemM/cg31+nW5NR+EEMoag89yIU4Vu 6cp4Ds2SdZ1FdONyDtr487fadvrTZel39kfy1pj7y3P6fCvwvzocpdeFy6vBE5fUjBlb 8PynOc2HDPFrq6lHMddP7xzxAPkVATYFqW+9uMxNdQN6331of0sppX6/e0doNLwhFM66 1E7sJpiwz/Rdpu0Y2fNQ74bCR1qPI4WHkyrxIDYHqW9lSJOIL5rXoS6aujVUijKJyUD5 RbPQ1Tu0PhpmuOPhgpZOpQo13R3tBsJah7qT8bB/hyJ/INCopvCBbQm5e30YUT0m+zsY tl+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4iN+wCNn39PyCmqyIu9fXyF1t2chc7mKLTiK8TWZaXs=; b=n6p2Ut+kagCn2o0q34AHoUrsO9fUpRELv6V1SQeMkMzl27bu4NFic9CX030PENWExR lFJbn1dau/WM4meV4nabQSKKSB6bcdHRQaD5FJHBJ+0xhAsJ9qi1Eg2TQFxBShSkzJeF Z/d8NvPPnBzfZKJ4YPnbyZzGlo8mo11cMexNG56uztfFumg2mdUCi2BrHyI3p+vkjr8j UWwqKU8hY/fVWPXksBWGnCUultvEefFrBRqkLjaF6jhKxNDtVHh5ct3SnDMoBI9MxQS1 tJbFIx2F2N1kyOBhWoKWBQMjK8AAIWna9vCu8xNhT4wWodSLRp1pfYfFWF04EQc8ZdQ4 s38Q== X-Gm-Message-State: AOAM532sWQGdE1Yxyri3Rl5vLzrEUPfTolwNLJmfajkFh/tQslbJKWnX CfxKmwh33Sxz2B6mAG8u7fNzMjwbfhB/vg== X-Received: by 2002:a0c:edb0:: with SMTP id h16mr27487471qvr.17.1635877523902; Tue, 02 Nov 2021 11:25:23 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id y9sm13701081qko.74.2021.11.02.11.25.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 11:25:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v2 05/12] target/arm: Advertise MVE to gdb when present Date: Tue, 2 Nov 2021 14:25:12 -0400 Message-Id: <20211102182519.320319-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102182519.320319-1-richard.henderson@linaro.org> References: <20211102182519.320319-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f33; envelope-from=richard.henderson@linaro.org; helo=mail-qv1-xf33.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?b?YXVkw6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Cortex-M CPUs with MVE should advertise this fact to gdb, using the org.gnu.gdb.arm.m-profile-mve XML feature, which defines the VPR register. Presence of this feature also tells gdb to create pseudo-registers Q0..Q7, so we do not need to tell gdb about them separately. Note that unless you have a very recent GDB that includes this fix: http://patches-tcwg.linaro.org/patch/58133/ gdb will mis-print the individual fields of the VPR register as zero (but showing the whole thing as hex, eg with "print /x $vpr" will give the correct value). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20211101160814.5103-1-peter.maydell@linaro.org> Signed-off-by: Richard Henderson --- configs/targets/aarch64-softmmu.mak | 2 +- configs/targets/arm-linux-user.mak | 2 +- configs/targets/arm-softmmu.mak | 2 +- configs/targets/armeb-linux-user.mak | 2 +- target/arm/gdbstub.c | 25 +++++++++++++++++++++++++ gdb-xml/arm-m-profile-mve.xml | 19 +++++++++++++++++++ 6 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 gdb-xml/arm-m-profile-mve.xml -- 2.25.1 diff --git a/configs/targets/aarch64-softmmu.mak b/configs/targets/aarch64-softmmu.mak index 13d40b55e6..d489e6da83 100644 --- a/configs/targets/aarch64-softmmu.mak +++ b/configs/targets/aarch64-softmmu.mak @@ -1,5 +1,5 @@ TARGET_ARCH=aarch64 TARGET_BASE_ARCH=arm TARGET_SUPPORTS_MTTCG=y -TARGET_XML_FILES= gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml TARGET_NEED_FDT=y diff --git a/configs/targets/arm-linux-user.mak b/configs/targets/arm-linux-user.mak index acecc339e3..3e10d6b15d 100644 --- a/configs/targets/arm-linux-user.mak +++ b/configs/targets/arm-linux-user.mak @@ -1,6 +1,6 @@ TARGET_ARCH=arm TARGET_SYSTBL_ABI=common,oabi TARGET_SYSTBL=syscall.tbl -TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml TARGET_HAS_BFLT=y CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y diff --git a/configs/targets/arm-softmmu.mak b/configs/targets/arm-softmmu.mak index f6c95ba07a..92c8349b96 100644 --- a/configs/targets/arm-softmmu.mak +++ b/configs/targets/arm-softmmu.mak @@ -1,4 +1,4 @@ TARGET_ARCH=arm TARGET_SUPPORTS_MTTCG=y -TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml TARGET_NEED_FDT=y diff --git a/configs/targets/armeb-linux-user.mak b/configs/targets/armeb-linux-user.mak index 662c73d8fb..f81e5bf1fe 100644 --- a/configs/targets/armeb-linux-user.mak +++ b/configs/targets/armeb-linux-user.mak @@ -2,6 +2,6 @@ TARGET_ARCH=arm TARGET_SYSTBL_ABI=common,oabi TARGET_SYSTBL=syscall.tbl TARGET_WORDS_BIGENDIAN=y -TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml TARGET_HAS_BFLT=y CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c index e0dcb33e32..134da0d0ae 100644 --- a/target/arm/gdbstub.c +++ b/target/arm/gdbstub.c @@ -199,6 +199,27 @@ static int vfp_gdb_set_sysreg(CPUARMState *env, uint8_t *buf, int reg) return 0; } +static int mve_gdb_get_reg(CPUARMState *env, GByteArray *buf, int reg) +{ + switch (reg) { + case 0: + return gdb_get_reg32(buf, env->v7m.vpr); + default: + return 0; + } +} + +static int mve_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg) +{ + switch (reg) { + case 0: + env->v7m.vpr = ldl_p(buf); + return 4; + default: + return 0; + } +} + /** * arm_get/set_gdb_*: get/set a gdb register * @env: the CPU state @@ -468,6 +489,10 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) 2, "arm-vfp-sysregs.xml", 0); } } + if (cpu_isar_feature(aa32_mve, cpu)) { + gdb_register_coprocessor(cs, mve_gdb_get_reg, mve_gdb_set_reg, + 1, "arm-m-profile-mve.xml", 0); + } gdb_register_coprocessor(cs, arm_gdb_get_sysreg, arm_gdb_set_sysreg, arm_gen_dynamic_sysreg_xml(cs, cs->gdb_num_regs), "system-registers.xml", 0); diff --git a/gdb-xml/arm-m-profile-mve.xml b/gdb-xml/arm-m-profile-mve.xml new file mode 100644 index 0000000000..cba664c4c5 --- /dev/null +++ b/gdb-xml/arm-m-profile-mve.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + From patchwork Tue Nov 2 18:25:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516694 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp4867382iml; Tue, 2 Nov 2021 11:32:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpfYcWfpm9R2bfB8rRkg7Zz7UdALzOHPP9keSHUcU+94HkP8StpXP32nXuA7oxEQrkomJB X-Received: by 2002:a9d:7306:: with SMTP id e6mr3851703otk.306.1635877935647; Tue, 02 Nov 2021 11:32:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635877935; cv=none; d=google.com; s=arc-20160816; b=ZZCZ77l5Aau3Ey/K//TbOGR7YUbOaEQsTN4olH3XNLuW9xslDkriEPIQJFYIhNL5c1 JgTCLok82jdJxYs1yptw7nxlwAHkLQjrQVQAtd8dFtXLeDSeX5gSEW4nd7P5u+v+n/+W N9qBwfFwHaJNti89jhsLjRuue5eEmtqH3yerj9s8LQyvRWuR5YGQsXC3GaBRwNSxi83X UcDlj/uP9+vfa6F7EN86JLRMwXo8Ye5XqCo8gK6CfE5RcyklPr68y4VxjM9TveKIDKxf LvG2orMe29dcdJ6sFLLYnAlzmayp/qdI+Nhv+LTqls+gH8V4b30a+a4Yz9bHeY9FHgiD Zv2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=5cdNvFSJ5wR7JnuiQcjHWFGJQar8vceYVcWEUN+hvfs=; b=P1Rg9w3gNozR3dU0H2FkUmyC0+wRaz1V2G4ls30hMrk24Jn2F4uFvM1deq/YbqNXon 3ujmpTJyryqoXC7Ii7xmTDd6wKIl2OqK1EUSFevkn5114Hy8wARSe8Uq6wddas3SxbnB vlhezCsSLmDneOHW3c4yyh9xAUIkUIPLyiWI9I38j/cLCGKI66Sj1vrAHdDi3jJFOwsM G313j5XLNn7X/beTWV2WUXwZivsH8CKVYlZznHVQDA0E6cOoHHk+9bANgEbYTVyAKURi 54rdQDqFgL6tzMwkANYd/tOn0mdQlOdQmk2a+k2rnib4AiFDUdLkEZtuR6K6BGQJllo8 r81w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VOSJPPZW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e2si3890473otk.151.2021.11.02.11.32.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 11:32:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VOSJPPZW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhyZz-0002sj-1Z for patch@linaro.org; Tue, 02 Nov 2021 14:32:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhyTP-0005hx-Rv for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:27 -0400 Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]:41521) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhyTN-0004Dn-F7 for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:27 -0400 Received: by mail-qk1-x731.google.com with SMTP id br39so7352896qkb.8 for ; Tue, 02 Nov 2021 11:25:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5cdNvFSJ5wR7JnuiQcjHWFGJQar8vceYVcWEUN+hvfs=; b=VOSJPPZWeLBQXCjvvYW9upU7ndT9m+iNTIodh8sRpL4QF6o+AQmjkdlNCXI1nlEPob PkYIhZoZt2moJl/sqhjHI2xKgTNNCag0Ww3dA7Cn9QXwdDxtfs9pOSDiVpYN7qvr68OR ydKr4AnR3uxBrtwsSb0n7Jvi8R66Mpt0+VhK81Wede3Y0nVnLGuYvUit3j1Xf9puY6h7 UiGEvdtHKjb4vw8G3FBqcXbbmYSkGbhGnh4FW7gr2Vj7gXHCAOO9IfQIwy9Hl+oMEQeA uoaKmsucdfuizywxNthb7QiPsGE8TybuT3xmeM6ozL797U9AaMnRC1DX0FaEy67/pWHq AnuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5cdNvFSJ5wR7JnuiQcjHWFGJQar8vceYVcWEUN+hvfs=; b=JapSezJhaSXtIIFNlQQv2erj6mdUhbj9n4cq4dFO5pkCP6v0c1iacluOCglRBr3PKF 8TtyUgwEYWURnVh4IMg7R9etKN7g735nGvJX5OdSX2IzdT3ffo6sKbvWeVlrjDpJJTZC 3RPOGe4wGPcnEPpATxE0CvtAtyzub16ww2XTCjHF/heKtheufaMgZMSiZklneWADbuVG ivEOdHignNbIyParUBibEnBHyB2DBb1bl1CAfGjc4pAMxyOoLw2QWWheKx9Gm7L6ZXqT 625BEJvn46nFeuGlb6HaygsIX0tSw8AL3by9Y3I/nAe0xpLj/vubmePyPIjCwrB7SGLK Bc5g== X-Gm-Message-State: AOAM532kYsDIjGjr1+4tjjbOWYWTSAbdF1datUEy0GZubr0xYUGeoBtZ SeLx/QpSLJjI3xDofdPhmcnNWfL5WKsnYg== X-Received: by 2002:a05:620a:444a:: with SMTP id w10mr4547830qkp.462.1635877524589; Tue, 02 Nov 2021 11:25:24 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id y9sm13701081qko.74.2021.11.02.11.25.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 11:25:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v2 06/12] target/arm: Use tcg_constant_i32() in op_smlad() Date: Tue, 2 Nov 2021 14:25:13 -0400 Message-Id: <20211102182519.320319-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102182519.320319-1-richard.henderson@linaro.org> References: <20211102182519.320319-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::731; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x731.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Avoid using a TCG temporary for a read-only constant. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20211029231834.2476117-2-f4bug@amsat.org> Signed-off-by: Richard Henderson --- target/arm/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.25.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index d6af5b1b03..083a6d6ed7 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -7849,10 +7849,9 @@ static bool op_smlad(DisasContext *s, arg_rrrr *a, bool m_swap, bool sub) t3 = tcg_temp_new_i32(); tcg_gen_sari_i32(t3, t1, 31); qf = load_cpu_field(QF); - one = tcg_const_i32(1); + one = tcg_constant_i32(1); tcg_gen_movcond_i32(TCG_COND_NE, qf, t2, t3, one, qf); store_cpu_field(qf, QF); - tcg_temp_free_i32(one); tcg_temp_free_i32(t3); tcg_temp_free_i32(t2); } From patchwork Tue Nov 2 18:25:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516703 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp4880274iml; Tue, 2 Nov 2021 11:45:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6lfZ7e4j9anfQJYg+7RV0swoLPcTlRCd+fBv/470AE/4aXk6tS37iCbuGTqNhtjCkA2qW X-Received: by 2002:a9d:75d1:: with SMTP id c17mr24109593otl.304.1635878725978; Tue, 02 Nov 2021 11:45:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635878725; cv=none; d=google.com; s=arc-20160816; b=N77dIk6N2vnjzHBe1Hc37ED+MF/5eqQFuYh7VSNE9TdUDcwnom+CvDcDm3/vvldnCP /JxdcIajnpmvi7XPWjfiszMzwBWLVzxUgKzO15dVKcVHNO2ajeXWEWdjvc5Me0jrjJ1F c62IUDrZG6ve7Jajy4aFR2dPmYmmXgiUQCQleVY1OR1Rbq8ei3pf3RRTA47G+vN/fKse rQx1lymaGfynf5eWtG59BI4rS/1UBlisdwn+tHxm59KW/3QEOj2b/vDxQo8D6LbE6v7I Zd/CifYf7V85ThKaX9Y5SAvhrp+S9jbYIf0OUud9ES/nV2L21gK7RD2IkF2m/93e0sYp uXnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=kgIAZfpBiG9Bp0aRLB9BDRfUW43JbXvDwVrmE2eY/v8=; b=S8SYwrKw5AuBXpgDpmLtcV0VDAPU+9NzFYra24Zv2wC33H7AFr1fvrB4MiwmBoawEf 9yO+PzS9F0MPStGSmK6Ezxm5vcsJ2BPcVrHsE9CYSAoVCQcwO1j8ZpYn3zPZTUDFwFol 7VQW29thUjKoMX09kx9fGRMmoTz/qZIE7yWQKX4GldT5qS2rLd1Be/5OFNWD9AYMWAhF K+gVUw16B5vVUvMzr6ajDDUqMVNaaIP+dP+p5iMiXa/NK9X2Uy155wx4UYj+pJHCKTAd jzqG2wCstw3Q1B3VTKu3pKF8/ZoGU61wLs/A7AODrYhd4AM/RSFsz+ptx1ZvPDAHWbcj xOwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QvBYPJ9e; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e25si19858706oth.342.2021.11.02.11.45.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 11:45:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QvBYPJ9e; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhymj-00019M-DT for patch@linaro.org; Tue, 02 Nov 2021 14:45:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhyTV-0005pE-If for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:37 -0400 Received: from mail-qk1-x734.google.com ([2607:f8b0:4864:20::734]:41524) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhyTO-0004Du-6l for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:31 -0400 Received: by mail-qk1-x734.google.com with SMTP id br39so7352931qkb.8 for ; Tue, 02 Nov 2021 11:25:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kgIAZfpBiG9Bp0aRLB9BDRfUW43JbXvDwVrmE2eY/v8=; b=QvBYPJ9eP9HDjBTYk4pWXVBzsgnGUrcMi64W9WJ3B0vUXOA9pUjmBUkPdKALZZpCuI jxpxXcUByY6iiWHiZ7K+Xfzz3P0l7mZb3UVeiAe+3VKWWrmYXVx2LmpRqX64YVRP/aAZ 7T2qDEBLU/2p9cQI5flMXzVQc11kHXu7dTDmUiBLc7u71vGTcx0mpWeZBPZSwr9jmPcu FNeaE0vQdudI4YlHzak/K/bv3E3nVKFxHelBl7nLJI0eRHeplmu2Vl/EjhKa2FQEYTtA ia/qf4Y6LBuVMwaXKWjhH8nQarp7WybFtrr8Que6eZFbbt49iSlaZKfEHvSXMS8T+bRx 0tAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kgIAZfpBiG9Bp0aRLB9BDRfUW43JbXvDwVrmE2eY/v8=; b=199vet8K3ocbDvc+pLow8YIdaKKYEAgNMkvkYS+K5kvvqJO3MkXrzAgVXgxiUmkDd7 hwuWK9yoAJrvRpFkgOYpa4mRbiN0mCcBPBrMyQ+FRisUkxpHU/e5L93ztH1GDWCbEqNm YnD8v/JqdrCZDsF37HEBsDTnVMZ2ACXpPzVuA9Eu68gjmgGBa3SzssAIIC5lrfk3P0Eq uIWq91G50kIARCTU2J0IBix77V/SJQSTamLflIfyd3bjVyMfzjo9rl0oy4ohIrrDYL0G v94kA7q3DXZ3ob3EswgJcrjYPQ4mKTu516D4vgzX3LPySmMUfrTumBQrDhr8YDbpTRR1 f8HQ== X-Gm-Message-State: AOAM532hbi+BDCUk0LLvIBiLMTD3ac/4o7K/dNiwbArOOlxjwj3FNZy0 op7r3ea60n5tNKNiRliIfaYswTFDkrB0yA== X-Received: by 2002:a37:b386:: with SMTP id c128mr30251021qkf.426.1635877525259; Tue, 02 Nov 2021 11:25:25 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id y9sm13701081qko.74.2021.11.02.11.25.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 11:25:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v2 07/12] target/arm: Introduce store_cpu_field_constant() helper Date: Tue, 2 Nov 2021 14:25:14 -0400 Message-Id: <20211102182519.320319-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102182519.320319-1-richard.henderson@linaro.org> References: <20211102182519.320319-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::734; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x734.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Similarly to the store_cpu_field() helper which takes a TCG temporary, store its value to the CPUState, introduce the store_cpu_field_constant() helper which store a constant to CPUState (without using any TCG temporary). Suggested-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20211029231834.2476117-3-f4bug@amsat.org> Signed-off-by: Richard Henderson --- target/arm/translate-a32.h | 3 +++ 1 file changed, 3 insertions(+) -- 2.25.1 diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h index 88f15df60e..17af8dc95a 100644 --- a/target/arm/translate-a32.h +++ b/target/arm/translate-a32.h @@ -70,6 +70,9 @@ static inline void store_cpu_offset(TCGv_i32 var, int offset) #define store_cpu_field(var, name) \ store_cpu_offset(var, offsetof(CPUARMState, name)) +#define store_cpu_field_constant(val, name) \ + tcg_gen_st_i32(tcg_constant_i32(val), cpu_env, offsetof(CPUARMState, name)) + /* Create a new temporary and set it to the value of a CPU register. */ static inline TCGv_i32 load_reg(DisasContext *s, int reg) { From patchwork Tue Nov 2 18:25:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516700 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp4874506iml; Tue, 2 Nov 2021 11:39:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaacBBwIjJ+H1+FXkyeyBSr/YFWFuV0SG5Ugv0ozGkZixqYAsPprPGs5a2hJdlu934kU7o X-Received: by 2002:a4a:dc1a:: with SMTP id p26mr25803620oov.6.1635878345595; Tue, 02 Nov 2021 11:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635878345; cv=none; d=google.com; s=arc-20160816; b=EwOvSbRgyTj7nlBJlS3phG/+puULpMUZtNYMXLtVmHBSuVAUuYNws8EvzfrEA6v6RN 82jHkZyv7BdafEw17gdD4sDcGSdda/YmfUH62oQkTvFFcB5/99wICCnIXg1gh3+6JVhp iTXGRghlJUChk+h+C2ed7CDMio57CeQ/5Oz4pm0zJkZ6T0FTkhgGPozobmQGjqW3TCLO +Run2yhFLNzHctDuB0NhFzuYulYNGL0JC2i5OBHCRcU08fKhtU1zqEBnX/93dP2pVQH8 4xh1fLMKwB6qTA3mfo3pbILfo73AczCbAMFe5yQvBQhTTH88q2k0hj/KEgbFd2l3y0k3 uqTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=c0LVKpqK5ZdwRcDR8+puDfp4OkQJywpu1yKfC81QITE=; b=E+MsgV6y2eMGIiPA19fTne4SzhIXb58LipC9yySsMdN7bTw4R+rU1WZz1ypW2OA+7X S9KsIn/cR0xQ/Zwr8FxkXaAJTo5T5HjF+ho0IEtKwfWuz7JXp22LP/0f6TABQlj3PaxB pvxPN34zn3iUeVEdpkuMyO0slvKpssxNFAKCu8XUJtClFEtvZY7EtSWCTrkWo05phNg4 btYB3rLGJsDTEOCKj2K5AutBbEQV6usOnoy7ST2Ye6UrmKI1HYBIrAkvT4YItyznpdyG om7renKtWr1VG+wFQrhKY37RkR3khtcCElJa+haopcq7aOk7eEkwzh7w327OB7Y+i9U+ +XDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="m/ouuqdX"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o7si23240209oiw.306.2021.11.02.11.39.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 11:39:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="m/ouuqdX"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39486 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhyga-0002jM-Cy for patch@linaro.org; Tue, 02 Nov 2021 14:39:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhyTR-0005kw-6d for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:29 -0400 Received: from mail-qk1-x733.google.com ([2607:f8b0:4864:20::733]:36827) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhyTO-0004E2-RO for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:28 -0400 Received: by mail-qk1-x733.google.com with SMTP id i9so19990326qki.3 for ; Tue, 02 Nov 2021 11:25:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=c0LVKpqK5ZdwRcDR8+puDfp4OkQJywpu1yKfC81QITE=; b=m/ouuqdXtss4rsg58+7HV77K/xg9i/gjZdeTBN/m+EV84AEeB9fgcl5l2h0XE3xy1V mRnxTg7e5jHpF4I4IYXO1TvlEWeL9R6Y7xEubMUE94MTE7m0jRLytDPO5vH6TvlR3N33 em4j3rS0ImjDMUCqPxKImSKY9QrG2yoiERJBfT5FMv22Xp9UZBPsfGSegWTpp7J/EQAR wND2mVlqUYIHIenvixDhqlHNdf/vVlr59Ykvy5+0BSjdzUEhSB9GyUfpov1SoY8yuOpr H4Pt0hiHetEItYJ9mPte8XH3gmJde6+rWUlpk+KeSVgCg7MHytokrv/f7F5T5AC0OoM9 M/iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c0LVKpqK5ZdwRcDR8+puDfp4OkQJywpu1yKfC81QITE=; b=AY55KEdSXqk9I9EQWFRo8shOna65BT/agvk/jgyN41QVLNlRZ4TztiLDHEQ34lT3Dy 8rDet8dzmwdOkLoNblCE1CC11WECn6Hs6o0tJcyki9O6KsDyYeKEV7n/69IBflmsSybj vK9xbO6042cPZg9rLLR5kdIYtFIAXdYuArsFBruJV/JHQMZAQ/9AVRSTmbsxF1rIcVS3 CVv1V/HPh48V6IO0TxeGSC3I1Q0QIymnb6oreinpp1MYHRomhkkR/eE01YfLPqfTZCbH tJnxhMRSOJKFiz2c+91CLhBv5ZHIheqJl6BEMWxQg5P29+GJ4SWPz6VxdvZuFcSQE9nD v9Sw== X-Gm-Message-State: AOAM532tRO3wyJbN+ZXK5j2CLko27faYiUQfyB8b6e5+Nu4t6PJJXSPQ sJRBNXBcoESBoyPsyXh4lq+8uxnuXVclTQ== X-Received: by 2002:a05:620a:461f:: with SMTP id br31mr15017233qkb.436.1635877525919; Tue, 02 Nov 2021 11:25:25 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id y9sm13701081qko.74.2021.11.02.11.25.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 11:25:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v2 08/12] target/arm: Use the constant variant of store_cpu_field() when possible Date: Tue, 2 Nov 2021 14:25:15 -0400 Message-Id: <20211102182519.320319-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102182519.320319-1-richard.henderson@linaro.org> References: <20211102182519.320319-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::733; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x733.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé When using a constant variable, we can replace the store_cpu_field() call by store_cpu_field_constant() which avoid using TCG temporaries. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20211029231834.2476117-4-f4bug@amsat.org> Signed-off-by: Richard Henderson --- target/arm/translate.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) -- 2.25.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index 083a6d6ed7..52ba562c96 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -364,8 +364,7 @@ void clear_eci_state(DisasContext *s) * multiple insn executes. */ if (s->eci) { - TCGv_i32 tmp = tcg_const_i32(0); - store_cpu_field(tmp, condexec_bits); + store_cpu_field_constant(0, condexec_bits); s->eci = 0; } } @@ -740,9 +739,8 @@ void gen_set_condexec(DisasContext *s) { if (s->condexec_mask) { uint32_t val = (s->condexec_cond << 4) | (s->condexec_mask >> 1); - TCGv_i32 tmp = tcg_temp_new_i32(); - tcg_gen_movi_i32(tmp, val); - store_cpu_field(tmp, condexec_bits); + + store_cpu_field_constant(val, condexec_bits); } } @@ -8362,8 +8360,6 @@ static bool trans_BL(DisasContext *s, arg_i *a) static bool trans_BLX_i(DisasContext *s, arg_BLX_i *a) { - TCGv_i32 tmp; - /* * BLX would be useless on M-profile; the encoding space * is used for other insns from v8.1M onward, and UNDEFs before that. @@ -8377,8 +8373,7 @@ static bool trans_BLX_i(DisasContext *s, arg_BLX_i *a) return false; } tcg_gen_movi_i32(cpu_R[14], s->base.pc_next | s->thumb); - tmp = tcg_const_i32(!s->thumb); - store_cpu_field(tmp, thumb); + store_cpu_field_constant(!s->thumb, thumb); gen_jmp(s, (read_pc(s) & ~3) + a->imm); return true; } @@ -8677,7 +8672,6 @@ static bool trans_LCTP(DisasContext *s, arg_LCTP *a) * doesn't cache branch information, all we need to do is reset * FPSCR.LTPSIZE to 4. */ - TCGv_i32 ltpsize; if (!dc_isar_feature(aa32_lob, s) || !dc_isar_feature(aa32_mve, s)) { @@ -8688,8 +8682,7 @@ static bool trans_LCTP(DisasContext *s, arg_LCTP *a) return true; } - ltpsize = tcg_const_i32(4); - store_cpu_field(ltpsize, v7m.ltpsize); + store_cpu_field_constant(4, v7m.ltpsize); return true; } @@ -9487,9 +9480,7 @@ static void arm_tr_tb_start(DisasContextBase *dcbase, CPUState *cpu) /* Reset the conditional execution bits immediately. This avoids complications trying to do it at the end of the block. */ if (dc->condexec_mask || dc->condexec_cond) { - TCGv_i32 tmp = tcg_temp_new_i32(); - tcg_gen_movi_i32(tmp, 0); - store_cpu_field(tmp, condexec_bits); + store_cpu_field_constant(0, condexec_bits); } } From patchwork Tue Nov 2 18:25:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516696 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp4867473iml; Tue, 2 Nov 2021 11:32:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuJnQ0kBmDMz4BaoqOVMYJYIum21OLLyHRbM3yu3Vr8sp13ROKn2Do2PUOHsfPmtukJn4i X-Received: by 2002:a9d:a4c:: with SMTP id 70mr29239064otg.40.1635877939459; Tue, 02 Nov 2021 11:32:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635877939; cv=none; d=google.com; s=arc-20160816; b=k9RGannjx+EC0imC/sjVh8lb8boFtfiTs95aoTnaf8yMAr9gZw3ywEoSIQ7fa6sWUL RcFyQvzBeSVN+vjBguCTzefN1RTLlTrYYzdOLU2ibsp2/BtpcckBb0oKCET9qPOnIaGh ZcTCK8UjjTU2AUEdbjFCL9YDeckTZqvA5x9KnhZAlfYFOcAIFQ8yLO1whElrVinBGyTk E9e73y6924VO+sqff+tEUdzLCaAKsk4WUffjLL7IU5LpRSZyhiK5/7yL3GnFvU0Q9sOa CGI2DzhOyhAiyM10YHxXFU4haNW9UfWMwuNmyLT71jAHDuA8Q8FMKq/frftfFUvAqMvg Em4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=j4r+jFmgKYVYNdmx8Xu4OV+7rTClDutKXjKZGGfWtS4=; b=NYRtRZ1EBrKLuaaUMGLUGTzbu/P3TbEjaVZvKqCFzi1V+NDFAOVjNfso43B4ydcFeu c4mFMU8AuaBZgLEalaoQrnuvTX3uPfI+n5/C5ndlApUSd+hVAm7MDex8NJNri4t2x39+ rPD5NEeViV35SfnobXG2k2Uy91a02QUhTuej5cWlcf6BhY+JbKUjTZHrLWVUnykS5lRZ MI2U4xI++ZVIicDo41bIhOI/SIdaVOE9phQddHHR3t0TKkktEetneafHA+PskhJJhpBz vgHg50E4ffBXK6wgYkKcL5jP2MWEA93Oav58CxoaWJDn7GXp2Blr1ynScHmEXvDM80q3 77Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q4DpYx9F; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v12si19532908ooi.39.2021.11.02.11.32.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 11:32:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q4DpYx9F; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhya2-0003Bf-RS for patch@linaro.org; Tue, 02 Nov 2021 14:32:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhyTT-0005oh-7f for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:31 -0400 Received: from mail-qv1-xf34.google.com ([2607:f8b0:4864:20::f34]:41631) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhyTQ-0004EK-9h for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:29 -0400 Received: by mail-qv1-xf34.google.com with SMTP id gh1so13869422qvb.8 for ; Tue, 02 Nov 2021 11:25:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=j4r+jFmgKYVYNdmx8Xu4OV+7rTClDutKXjKZGGfWtS4=; b=q4DpYx9FidLblN4h0l8L9cPH97c/COjf5013faZBCaspzx2zM3JvYqjB2UzZEqgdxw C1+7xO2ztP3HR48UpuBOkioHZX0/7yvbPfXfF0sdblcHUt4hKGFwUlXE5UWaGgY7ZaHj zt4i+kuRTe85Yn/mNLKn1Pgezie+bOL1QnHr6gM474Q92YMj88+b+d1PQqWb4AQzHPSp E/m/Ii+qgRu3byzOEalgiTyLme+5gykT9fv2G6Sjn3b6czl0e+GPeNBpsKi/QrKydCcJ anZBCxu87ueiJ4GpcoH0Uf9f7Zg/EnpRuZ09VlB2PA90iRscsw3gWktrqx8tAvy+1qd5 NHDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=j4r+jFmgKYVYNdmx8Xu4OV+7rTClDutKXjKZGGfWtS4=; b=0vtO1yCYwogc6bd3+dvnWatNQWWtnsHC5nisqt8JbIjaz1+vJ/G7mrgBOgJIRETEaD jfUhCcMTr35WuoAgo/AB2ta/WqUqR2N6r3P0r8VerS79+o9SzQjGWxaRJL/iVcq9L6nZ rf2znC89zKLESYCLxRGlE8metB6jHEMLNAuZwwkXANVwlcUSn+0rgCHyWpQq5wWM5h3e Avt8lSbtxL8XpuylASZVanPOSAXkk8gwAPUyE9Lsn7yMPZcJAwVjrIcrEbUZ52KaqwNK HZjDTov02682BMdoStvGezQB344VvSP3xINtFYJ0yfZpnr4TOVsEMwDuCnr6POktjjRL xNnw== X-Gm-Message-State: AOAM5329odIaGGNmNz9xeT1giZ+pBcX4eefl44R4P64SNJi685Zkixr2 MmYuFp46z36r2b9CXRe/wOng6hOyVf6uWg== X-Received: by 2002:ad4:5dee:: with SMTP id jn14mr37468807qvb.53.1635877526458; Tue, 02 Nov 2021 11:25:26 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id y9sm13701081qko.74.2021.11.02.11.25.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 11:25:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v2 09/12] target/arm: Use tcg_constant_i64() in do_sat_addsub_64() Date: Tue, 2 Nov 2021 14:25:16 -0400 Message-Id: <20211102182519.320319-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102182519.320319-1-richard.henderson@linaro.org> References: <20211102182519.320319-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f34; envelope-from=richard.henderson@linaro.org; helo=mail-qv1-xf34.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé The immediate value used for comparison is constant and read-only. Move it to the constant pool. This frees a TCG temporary for unsigned saturation opcodes. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20211029231834.2476117-5-f4bug@amsat.org> Signed-off-by: Richard Henderson --- target/arm/translate-sve.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) -- 2.25.1 diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index bc91a64171..76b5fe9f31 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -1943,20 +1943,20 @@ static void do_sat_addsub_32(TCGv_i64 reg, TCGv_i64 val, bool u, bool d) static void do_sat_addsub_64(TCGv_i64 reg, TCGv_i64 val, bool u, bool d) { TCGv_i64 t0 = tcg_temp_new_i64(); - TCGv_i64 t1 = tcg_temp_new_i64(); TCGv_i64 t2; if (u) { if (d) { tcg_gen_sub_i64(t0, reg, val); - tcg_gen_movi_i64(t1, 0); - tcg_gen_movcond_i64(TCG_COND_LTU, reg, reg, val, t1, t0); + t2 = tcg_constant_i64(0); + tcg_gen_movcond_i64(TCG_COND_LTU, reg, reg, val, t2, t0); } else { tcg_gen_add_i64(t0, reg, val); - tcg_gen_movi_i64(t1, -1); - tcg_gen_movcond_i64(TCG_COND_LTU, reg, t0, reg, t1, t0); + t2 = tcg_constant_i64(-1); + tcg_gen_movcond_i64(TCG_COND_LTU, reg, t0, reg, t2, t0); } } else { + TCGv_i64 t1 = tcg_temp_new_i64(); if (d) { /* Detect signed overflow for subtraction. */ tcg_gen_xor_i64(t0, reg, val); @@ -1966,7 +1966,7 @@ static void do_sat_addsub_64(TCGv_i64 reg, TCGv_i64 val, bool u, bool d) /* Bound the result. */ tcg_gen_movi_i64(reg, INT64_MIN); - t2 = tcg_const_i64(0); + t2 = tcg_constant_i64(0); tcg_gen_movcond_i64(TCG_COND_LT, reg, t0, t2, reg, t1); } else { /* Detect signed overflow for addition. */ @@ -1977,13 +1977,12 @@ static void do_sat_addsub_64(TCGv_i64 reg, TCGv_i64 val, bool u, bool d) /* Bound the result. */ tcg_gen_movi_i64(t1, INT64_MAX); - t2 = tcg_const_i64(0); + t2 = tcg_constant_i64(0); tcg_gen_movcond_i64(TCG_COND_LT, reg, t0, t2, t1, reg); } - tcg_temp_free_i64(t2); + tcg_temp_free_i64(t1); } tcg_temp_free_i64(t0); - tcg_temp_free_i64(t1); } /* Similarly with a vector and a scalar operand. */ From patchwork Tue Nov 2 18:25:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516702 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp4877390iml; Tue, 2 Nov 2021 11:42:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyW4W6Pm7RbR2uuwmyEEKgE0uQoQvRyQRzrLUf1xlfZyhagoOZg0pq5hyIexjlTuXy5BUjT X-Received: by 2002:a9d:3634:: with SMTP id w49mr21185043otb.84.1635878536178; Tue, 02 Nov 2021 11:42:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635878536; cv=none; d=google.com; s=arc-20160816; b=BGVJeMeHMEAfWJhjOALOTFnh8JOYuygETwMWeEp4VxDYmx+6pS6vDNrs/qU83rt2ei KNEtkTh5Z1c8SFsDc4pqG6svykmvC6Lpuh9vQ88d/xih7hUIAgPL/MiEkSf2Lj6/Bv5N WC3Wcmu7GOO1h9y8g3Y8o1BWYd4IJeWG308KO+6oYplAgR5mqkN64qS+LzW9Cb98Vu7T YxBw6V/FMau7Z8RFhYV+rwoPqvTpr8lr6VEKDqu1v5fuWxXV7Ym11mY4fDJBztAao/lm cRY6o0G1DTmVrYlIsOAeyJp3oBnB4bTOpSnqxoBRGotEPcCAuYk3DT4bAaocnHCMSVEn Imaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=GgIC/L4O3idafA92xVJBzxSWcbdJlwK/CFRWNxE3FH0=; b=fP2k9zRTtv9MmVpJaN8VGqlP2blG44UgPr7ObCjIkjMcmCF8hVkl8O4rAvyfnOfkvA YCdEROOkCWgyhDw9+sN7XJenWrywxKA9wrDCEFWLJ8seXrXn9PI+6NVvc6BvnjPyqnXp 1KIXfDLFqUyJS4nwuIri23Guh14G8OX4guhyV7cDPaQO05Jp3aDZNrzz1sPMRL4U2GpB VjezBlA+SS/i5q4li0HE4NRduLo2aOksjjkaEDbqtU1mvhmBFCd4rbQA7Br6CZJImUiZ 1nmqqB1uoTYjjBkFk7Q6f3JEa4BeOR8Df7x3+h7Ssxy15YANOkS/JM/RU+kOt6umifYW XdNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LZsccg3X; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m5si17383150ote.293.2021.11.02.11.42.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 11:42:16 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LZsccg3X; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhyjf-0006dd-MR for patch@linaro.org; Tue, 02 Nov 2021 14:42:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38742) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhyTS-0005nk-CT for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:30 -0400 Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]:38406) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhyTP-0004EP-TZ for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:30 -0400 Received: by mail-qk1-x729.google.com with SMTP id bi29so20509552qkb.5 for ; Tue, 02 Nov 2021 11:25:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GgIC/L4O3idafA92xVJBzxSWcbdJlwK/CFRWNxE3FH0=; b=LZsccg3Xc7wmOm3sdWUkKJSa5jgdicBF5AuuOODmBXXxwi8KpZD8eMCuOZAM8jB/3Y 9mySbsr9fKI7cngLYOWn3RHRLch58rOu4aDruI4w4IE+8ydIhCIQHbMfZ6r3eh/Eqj2p VVz6VU4YVJoDsk59rxbiDamv6RtGdGdjbgTWP1qGhPeVKyHtK24uN34Q9dI7qx/XP8eZ /8kMiuQVi8uqOxKcOWrgosXekakKwckxcE4nrtxxrnH3PRjgpd/9LrklTwZMuNjvc00D 5ON1StSpoNazuOTAXm4tVHq2qNbLrD6oGhe0CB4QatNWMjEfBeP6Bbjv1a05ckrXeVzV V5Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GgIC/L4O3idafA92xVJBzxSWcbdJlwK/CFRWNxE3FH0=; b=AzK0aE9EnNOmHB9Hg7H1ywZ04UHmRmU3iyV2tuw/mgEOiG4WvMafZihTPWUk901exM fzaGFFixmlrMAhVExlhBfa7Oy/0IJIWDyiN6tNmydcRkKnKAQ+A6OaHiFZGhZOueM9vO /FYN/IDzquWdJWHEK7lhSTjBpvJ9YAUtvQmv6yt0tIKVr3vt5P0l93tnPAFfkaswruRp AqlCMBN4YG49tg0MRGpDF1fal+8Gz/AZJLh0mT6/RHPRI+Q3gFvCzMxRB2nVlUXh8v1l VRs58GrJbh/ganGraCvwPayBxXAsuEo72TayWAM3hyi3JPbcxOSJYSc5v8EdS5MMdDEx kMpA== X-Gm-Message-State: AOAM5315dHXei9yzqoIMMBboBjA8x5b16lVDdRnUp167ua4g3QB4LvXG qHX4huNA06lO95YESi6MVnP83ZMpe7RXcA== X-Received: by 2002:a37:44ca:: with SMTP id r193mr31134365qka.190.1635877526996; Tue, 02 Nov 2021 11:25:26 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id y9sm13701081qko.74.2021.11.02.11.25.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 11:25:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v2 10/12] target/arm: Use tcg_constant_i32() in gen_rev16() Date: Tue, 2 Nov 2021 14:25:17 -0400 Message-Id: <20211102182519.320319-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102182519.320319-1-richard.henderson@linaro.org> References: <20211102182519.320319-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::729; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x729.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Since the mask is a constant value, use tcg_constant_i32() instead of a TCG temporary. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20211029231834.2476117-6-f4bug@amsat.org> Signed-off-by: Richard Henderson --- target/arm/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.25.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index 52ba562c96..98f5925928 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -388,13 +388,12 @@ static void gen_smul_dual(TCGv_i32 a, TCGv_i32 b) void gen_rev16(TCGv_i32 dest, TCGv_i32 var) { TCGv_i32 tmp = tcg_temp_new_i32(); - TCGv_i32 mask = tcg_const_i32(0x00ff00ff); + TCGv_i32 mask = tcg_constant_i32(0x00ff00ff); tcg_gen_shri_i32(tmp, var, 8); tcg_gen_and_i32(tmp, tmp, mask); tcg_gen_and_i32(var, var, mask); tcg_gen_shli_i32(var, var, 8); tcg_gen_or_i32(dest, var, tmp); - tcg_temp_free_i32(mask); tcg_temp_free_i32(tmp); } From patchwork Tue Nov 2 18:25:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516698 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp4873156iml; Tue, 2 Nov 2021 11:37:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyB6/B/z+/3el3NZg9DyJx3URB8jITUBwY5qmbYK6JN/liAKCr8Gklw1vA9zhkxAAvSWXcw X-Received: by 2002:aca:3cc1:: with SMTP id j184mr6761685oia.174.1635878267166; Tue, 02 Nov 2021 11:37:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635878267; cv=none; d=google.com; s=arc-20160816; b=MUFILeJH+MoSYY9VuofiZUoZCMkict3MEScOt4kS3OfETtYS7aYDTSPXglYnwehlPB oaKQ0EWkQOWpHgMwcI9BqIdrpINIjv+QMXfw3gVBPINJjur7O2hQwuoQ9vS803Fil/E1 E4aLhb8p43fSqaHzL7HLP1C82m2EeuNFBee959JQrXgU3EKPUaCKk+tcozz9Lg/iGVbQ 8IPr9EHdUykaXS/1fQ8BgSxk6bNJ1cHDAIZLEPzNP0irVpzPMB7jY0fNspxBDZFtROXp yQQVi61vk9igRcYndvth7/kjgd3R3GuDyJvL9pm/kxraANA4XCJmg+Hu6NQ1dwdhamsn OWhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=gjZPVUhejzMPbTovw5hhnqve/TPMZkIYSlSBPY79smc=; b=WWJ22dHVZF0dy1zAYAOBdXrWqzAWrMf0EHoZwubFPFFv7WyWrmBD/oA8l9C/PXSK8B 10lJc9nltIj02QOhyTxqkZge6X4FIZPnN308UqcVH5DmEpONVeSRo0GLVnKq2vlmMxFi QWowBJ+oB0n1HSpxAsD7gtY/2Sbr6oDuFAdSTNqJShpanaA6gqYcX7lxzef6iwg5TJUw qEvNt5No2YWGlu0C2YD9hxx3cGXe7mZkUYmhEqtAq3Rj1dFpfCtgRbj9D1MXJaWrm8ep BNjhXxNGfc/cbjSCdsly44tn9AQTnjSvSg9ysY3NqowkdMsPyeT09JpxbNMFdHYl0A/e ZswQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zAHBUHDD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 4si5272540ois.278.2021.11.02.11.37.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 11:37:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zAHBUHDD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhyfK-0000MM-KY for patch@linaro.org; Tue, 02 Nov 2021 14:37:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhyTT-0005oe-3j for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:31 -0400 Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]:45912) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhyTR-0004Eg-Ka for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:30 -0400 Received: by mail-qk1-x732.google.com with SMTP id n15so7022666qkp.12 for ; Tue, 02 Nov 2021 11:25:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gjZPVUhejzMPbTovw5hhnqve/TPMZkIYSlSBPY79smc=; b=zAHBUHDDaodCGT3YW8qxmynZYoCnWg0Bse3sB7efNdFYEpLGAyIf06cKc+MG6ZUJu3 tH0KnePTNGMPeRuuBldtUCV744oXkGQRQg1MuujqoryoL42EZ8spKbm0HFsCnlFhUhEl QiYh46l0ieokMUSiTsJ3GY4UHISOktOkf47VysA/jPkI1OIeXYA0bcvs5gDpkGMC4O4Q dQmzNJoP7LKjuZoP9/usiUf/h/fFwomhZc6yJYncJLggdKF5sPjli25FJQCdX62tAC8C 0cGgWYulBHqCV16FbOeTA515WpbskW3Pk7zt9TItcaLTgRikq+217qVEZwmCcPNJQQrG u6kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gjZPVUhejzMPbTovw5hhnqve/TPMZkIYSlSBPY79smc=; b=SqL9g+uz42RFwI1V/k9dd0z1hV2sR3RFlwAVByzhu6RoL1V9gDJDYS46xeEJ/YyGPi qMmDIIQMWyEeHOdeRK/mkZXU3ihpSEnTaeb3Oz5a7dHBBnHaN3ERnKSJQJPlqp1Y4o9t D763BwrJehptvat5MqUm9XS4yip4ql3wGvZza5iyel9XzP8qABztREiWcs2vT6QLi9nU +gUsaMivUZGEZEakoGtrmhYKxrb7XynaCCWZuZ4ny6Bf+zZbMDVrf5U22+HMA4NfqxDC BUh67Wpzwfgck+daHbo+oZ91zID53L23FgzPQJkmr7KKVOKnyKaSgBs1jlqXJWpsRHTN 2T6A== X-Gm-Message-State: AOAM533AhowsDB31oDxKCAdnhJvycjb7e39pZQs27wrVDqdNa8a5W/74 IixXXyal5oKQsWC3rkSXdQGhpagdd3AIJQ== X-Received: by 2002:a05:620a:171e:: with SMTP id az30mr21373924qkb.20.1635877527783; Tue, 02 Nov 2021 11:25:27 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id y9sm13701081qko.74.2021.11.02.11.25.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 11:25:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v2 11/12] hw/arm/virt: Rename default_bus_bypass_iommu Date: Tue, 2 Nov 2021 14:25:18 -0400 Message-Id: <20211102182519.320319-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102182519.320319-1-richard.henderson@linaro.org> References: <20211102182519.320319-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::732; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x732.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jean-Philippe Brucker , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Eric Auger Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jean-Philippe Brucker Since commit d8fb7d0969d5 ("vl: switch -M parsing to keyval"), machine parameter definitions cannot use underscores, because keyval_dashify() transforms them to dashes and the parser doesn't find the parameter. This affects option default_bus_bypass_iommu which was introduced in the same release: $ qemu-system-aarch64 -M virt,default_bus_bypass_iommu=on qemu-system-aarch64: Property 'virt-6.1-machine.default-bus-bypass-iommu' not found Rename the parameter to "default-bus-bypass-iommu". Passing "default_bus_bypass_iommu" is still valid since the underscore are transformed automatically. Fixes: 6d7a85483a06 ("hw/arm/virt: Add default_bus_bypass_iommu machine option") Signed-off-by: Jean-Philippe Brucker Tested-by: Eric Auger Reviewed-by: Eric Auger Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20211026093733.2144161-1-jean-philippe@linaro.org> Signed-off-by: Richard Henderson --- hw/arm/virt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/hw/arm/virt.c b/hw/arm/virt.c index ca433adb5b..369552ad45 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2737,10 +2737,10 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) "Set the IOMMU type. " "Valid values are none and smmuv3"); - object_class_property_add_bool(oc, "default_bus_bypass_iommu", + object_class_property_add_bool(oc, "default-bus-bypass-iommu", virt_get_default_bus_bypass_iommu, virt_set_default_bus_bypass_iommu); - object_class_property_set_description(oc, "default_bus_bypass_iommu", + object_class_property_set_description(oc, "default-bus-bypass-iommu", "Set on/off to enable/disable " "bypass_iommu for default root bus"); From patchwork Tue Nov 2 18:25:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516701 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp4876926iml; Tue, 2 Nov 2021 11:41:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwduIu0kPL7/IbPXXK5Pr03OlyQlMXXefk057e7en8I67abNwomTB3sdv3cdRKf1HVKfVJL X-Received: by 2002:a4a:958b:: with SMTP id o11mr25933568ooi.35.1635878501470; Tue, 02 Nov 2021 11:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635878501; cv=none; d=google.com; s=arc-20160816; b=g7X2BTUdDEyJFhat/BSsrkleYAKOhKdeL825JkoOZpDBOxP8/lSA1nlWRhF3EynQHa /gBpXCrORtK3L8kXWrU4xiZUmIz9FImIv8Rg+jmSNLqFGyvrYBhNgaFd98dzq6Jge3w4 RrFFKC2+tHkLvXMitoHPr0PRWPFvi+mN0vElrg+s5RE3Q6k7PT7uO5Wjssh2Sutcc2Dt SH8Ob3aA8I0Twi4ypAYnp5TimHEbumoex2ynhVZqGTLn/VxDarhMmtskbW5cN4kKL/cp NSfsPI6L6c5OUhCEyI5TZS7ia3WezQsSeAnsV26kvbkSkCZgWLb0UrFel5TSALIRGd+8 aB5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=7Kz+tFXT6K2UnZ30LjvUt2SSF2VfSMoswo/CAJ5bGD8=; b=AVLfk5Ewk1+8a8vnP5Qus6NhnpwoozgVCCi24tGEx6UBbrmxm1hn1a8LRGD1o9Di0R PY8NFo6nM4K7OHGLkmH+KHEux12g8OML4mIyPwjwMK5RpP+aIqAragc8XaC/F1GrI5nl 0WyeEMM/CPpyvktr2kLQWv5p6JPDbG+dL8sXlR5qnMiFxdDMAP4Eom+FuC/me4OCdHmZ ZpUOYG7A/374hdd1c3Zlm2jDExyQTFyDIJZdKrdEFuCE1MtIdkuaxIdHPedfsztJ+b1F zQKLmgJ6EWoxzVh8t/gKGORZOP6/0f7MHt2TsdPcksNf6w7/FF6f2NSm23Jekd6zi3bg /q4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=RoBJMFvy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j7si12100284otu.339.2021.11.02.11.41.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 11:41:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=RoBJMFvy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhyj6-0004xA-W1 for patch@linaro.org; Tue, 02 Nov 2021 14:41:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhyTU-0005rU-Ei for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:32 -0400 Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]:40490) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhyTS-0004Er-DW for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:32 -0400 Received: by mail-qk1-x72b.google.com with SMTP id ay20so5219934qkb.7 for ; Tue, 02 Nov 2021 11:25:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7Kz+tFXT6K2UnZ30LjvUt2SSF2VfSMoswo/CAJ5bGD8=; b=RoBJMFvyHtgjdSELtMp7ShBpBzmLUd5vs5yshJw8ZlxLKLZebCMehwaYw+qDyoB/m+ csV/RETGHql3CUxH283f5BlH8FJuJrwzOrHxu1h8n/OGSaePX6YDrRzC52dc1oE/dfc4 UH/YOMwMmaWqSms/hSTs7Isrb0AcaSWOMIjqFdHPzMagAWrHU8ouLTC+Zd3ndIPZiOzI ecc+L0iGjBMQeryUsmsnm5wI8Clg3ztYHpDd6SnML4mPRK3F96lZREmntpopOMg7ZcpF EEKFDvUas7wQaPmy9td2Sr25sJ0A1O+7BjqVZV90qKrsWg0NJ4mZnTm4JrX4q0nwqNSN 1/eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7Kz+tFXT6K2UnZ30LjvUt2SSF2VfSMoswo/CAJ5bGD8=; b=Yt65eUllePMDcxyQJiVvrPjEk+qjIipgXlHQuoI5ha0cPtiRvcIXF9Fhzn8sGhIKZS vq50LfQNU0VcJDOiTgZ4gWfCMBpNgi+4G9tONyVVBgcl047beUOkWShvXSNuhv9tbUo7 T9j2djf4aA7DB5Qkj07+DrX9P3pjhn88QR59UjQjMitZrtapaOmIPHK2kfuH9LnBoRlk Z0TCvkVHri/LpFgPss7audwSo4e0cuBfMKWiBerbr7OyCayKYrnbH5QFml8cKFiMD6nq N7ZfLPWuNU7iIi8nQzO1I6yG5D3BWl6QdzP6wsJIp8TgJswgkEsOXp/LoiyP9E6tOjYF XgnQ== X-Gm-Message-State: AOAM530Jjw+vHE1jvQ5I1zIQRthUym0Y3kVMgQxeVQkVeX2MWGea8WLP Ph9FrSQ7SHr2jlasBbMJ7ZZTcsCo7Mvf5w== X-Received: by 2002:a05:620a:2a10:: with SMTP id o16mr9043917qkp.88.1635877528333; Tue, 02 Nov 2021 11:25:28 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id y9sm13701081qko.74.2021.11.02.11.25.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 11:25:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v2 12/12] hvf: arm: Ignore cache operations on MMIO Date: Tue, 2 Nov 2021 14:25:19 -0400 Message-Id: <20211102182519.320319-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102182519.320319-1-richard.henderson@linaro.org> References: <20211102182519.320319-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72b; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x72b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Kettenis , Alexander Graf , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , AJ Barris Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alexander Graf Apple's Hypervisor.Framework forwards cache operations as MMIO traps into user space. For MMIO however, these have no meaning: There is no cache attached to them. So let's just treat cache data exits as nops. This fixes OpenBSD booting as guest. Reported-by: AJ Barris Signed-off-by: Alexander Graf Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Mark Kettenis Reference: https://github.com/utmapp/UTM/issues/3197 Message-Id: <20211026071241.74889-1-agraf@csgraf.de> Signed-off-by: Richard Henderson --- target/arm/hvf/hvf.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.25.1 diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index bff3e0cde7..0dc96560d3 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1150,12 +1150,19 @@ int hvf_vcpu_exec(CPUState *cpu) uint32_t sas = (syndrome >> 22) & 3; uint32_t len = 1 << sas; uint32_t srt = (syndrome >> 16) & 0x1f; + uint32_t cm = (syndrome >> 8) & 0x1; uint64_t val = 0; trace_hvf_data_abort(env->pc, hvf_exit->exception.virtual_address, hvf_exit->exception.physical_address, isv, iswrite, s1ptw, len, srt); + if (cm) { + /* We don't cache MMIO regions */ + advance_pc = true; + break; + } + assert(isv); if (iswrite) {