From patchwork Tue Jul 25 10:24:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 706135 Delivered-To: patch@linaro.org Received: by 2002:a5d:464f:0:b0:317:2194:b2bc with SMTP id j15csp98724wrs; Tue, 25 Jul 2023 03:26:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlEjUv3eXd5dvPlLrgA7xlhtxjdtdZJRiiSqVIbfpjIoAsSxsmGydy+th/jBlSOJdPqs5kFF X-Received: by 2002:a05:6808:1514:b0:3a4:8b4:bba9 with SMTP id u20-20020a056808151400b003a408b4bba9mr14016088oiw.44.1690280786012; Tue, 25 Jul 2023 03:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690280785; cv=none; d=google.com; s=arc-20160816; b=paxSR4TawFG38T0Ii0rZZWZtjD4CWgFreDbfZR+/2K8a/dhW2NulZFSe0OGat2GMMa +LGJcfeXONrujQ+9buO1U2jzfvc8yCmo3aBq7M7pwLL+UUfkYrBRMubfjvemRG7f6TTA dkHSrmbwt0WNy6KJpmCDarmpS+OpGuu8ZzSqGVwteKCXZ8hFqUkLrukcxhB3XNbj3Vep OdWKjZRChC8/RfON2Vp80vGB3euloisOC0UD896baBxBoOY1IIavn4pKmc+2iZg2duuS 6IsTEA+GLZtwGiJo9GSotYqyb1/mo1QEXlaSYL2Sq4a7o4m2UFrYI2Q+tOqt+QA++aN5 5Qfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=1Jm/TnD4O7VFYNm2su9Cb/vD/nMW66SkothMb1GxbsM=; fh=bFDrUYhlTVi/QyetgXx/byg2+yO/22Hp9SjwoefyKLk=; b=IQdTP6Sh/k+59rpGBVBzZ4vhn1LObW7vXA8/V4N+HzhYZLQbhBRNAy1nOJ2m2SH2lV mHdCXqPr73SR030krXc4NnlW8+nDAZvaBQnkplyQKqRcEDI96pOZ5mvhMVfek6lEJZv7 bac1jBhlDAoxgFRnmPUwdKJRnHRnhwzeQsuVxPjCVJuMXgS4i55h4viEcvomsShUh7ce 4ys6pgPIcG7QIG9HodVyXvCN9dwSIAzM7BXWoMMpnkwhHvLsc+EyIK5AUkANPVbfepnm C7DHrhhKxwY9kkChgvEJ1BMnbaaVaQyWkAOmKAsX/LAZZpLmZuGi5sWGts79TwUbxfhm /rNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="VWSJ3nR/"; 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 c23-20020a05620a269700b00767d64f382bsi6194171qkp.514.2023.07.25.03.26.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Jul 2023 03:26: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="VWSJ3nR/"; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOFEW-0000RF-3J; Tue, 25 Jul 2023 06:25:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOFE6-0000Ge-UO for qemu-devel@nongnu.org; Tue, 25 Jul 2023 06:25:11 -0400 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qOFE4-0007V3-MI for qemu-devel@nongnu.org; Tue, 25 Jul 2023 06:25:10 -0400 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4fdfefdf5abso1234618e87.1 for ; Tue, 25 Jul 2023 03:25:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690280705; x=1690885505; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=1Jm/TnD4O7VFYNm2su9Cb/vD/nMW66SkothMb1GxbsM=; b=VWSJ3nR/xVwi9T59lWXCEp41Dpkk8vZ6zqhcsrryL5CEoLRPcpAG2Hk7BoqLjRAaXI o2QdrLn3E0CqcSvi0mggkLMGMlUb10s8NTzZko/DX20imaVDGOiY3Wtl/YDpw+u8nrpl ZEW/VXuGJ/ZNHZFtlZ5NRjnDPWFpV2ZhiHscMUAuyW0dxUq0+hE/uo6mtQ9q4efkMjgA 6mQBubu2y896guVPy0XfeGFw6Wxi6sJ8Ap8w5Wv26wwoFVfEUSycZ7suBpksWQO7mcXl NKsPiXLLY217TJN2SH3xunDMwRxqzkb3KgvEE/qqGWn3XJLcJVT8l28afR8CWB0rSwsO cwfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690280705; x=1690885505; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1Jm/TnD4O7VFYNm2su9Cb/vD/nMW66SkothMb1GxbsM=; b=E0FybhT8YjKUY12OC0D0h/1rwQoz/eQMn9oaq6jshf67ulY+eVtu+XPqFVgCLCSGIT AQELuP6b9T9rnZCKMx2DDsMOtROHRu3sB6UGE1JeJrwSRZf1CX2shofKsGvZCH4VSyAV KbYhzmRIbZcYMVq9EpovgEvuNCL4zBoRYqWXDxRsZV3sWP16/gQRY5tMtffis1LHzJxQ Ylp6hW5shtYcw7m2RoaGb4XKwt1XaiS5CSq2Q2Ll6/fKRnNSuYehtHOjZ/hJE8IAs7Rs pOt88pjZzEnb36E8aY5HPASL8/DPQ8vHlh1e4inumFR5wSk7ALdBtaww8jlX2oKUw/07 1U6w== X-Gm-Message-State: ABy/qLYkEVjt00waPTakWjAtYyfwpXsE4I2vLPDb99zN4XqmkWcilp4k shyK3bRz3Mx+72gsdEu4zdFyKvLc3hBrRg++Zw8= X-Received: by 2002:ac2:5e7b:0:b0:4f9:5711:2eb8 with SMTP id a27-20020ac25e7b000000b004f957112eb8mr6364981lfr.33.1690280705568; Tue, 25 Jul 2023 03:25:05 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id u19-20020a05600c211300b003fbc30825fbsm12567185wml.39.2023.07.25.03.25.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 03:25:05 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 1/5] hw/arm/smmu: Handle big-endian hosts correctly Date: Tue, 25 Jul 2023 11:24:59 +0100 Message-Id: <20230725102503.2283907-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230725102503.2283907-1-peter.maydell@linaro.org> References: <20230725102503.2283907-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x131.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, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The implementation of the SMMUv3 has multiple places where it reads a data structure from the guest and directly operates on it without doing a guest-to-host endianness conversion. Since all SMMU data structures are little-endian, this means that the SMMU doesn't work on a big-endian host. In particular, this causes the Avocado test machine_aarch64_virt.py:Aarch64VirtMachine.test_alpine_virt_tcg_gic_max to fail on an s390x host. Add appropriate byte-swapping on reads and writes of guest in-memory data structures so that the device works correctly on big-endian hosts. As part of this we constrain queue_read() to operate only on Cmd structs and queue_write() on Evt structs, because in practice these are the only data structures the two functions are used with, and we need to know what the data structure is to be able to byte-swap its parts correctly. Signed-off-by: Peter Maydell Tested-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger Message-id: 20230717132641.764660-1-peter.maydell@linaro.org Cc: qemu-stable@nongnu.org --- hw/arm/smmu-common.c | 3 +-- hw/arm/smmuv3.c | 39 +++++++++++++++++++++++++++++++-------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c index 5ab9d45d58a..f35ae9aa22c 100644 --- a/hw/arm/smmu-common.c +++ b/hw/arm/smmu-common.c @@ -216,8 +216,7 @@ static int get_pte(dma_addr_t baseaddr, uint32_t index, uint64_t *pte, dma_addr_t addr = baseaddr + index * sizeof(*pte); /* TODO: guarantee 64-bit single-copy atomicity */ - ret = dma_memory_read(&address_space_memory, addr, pte, sizeof(*pte), - MEMTXATTRS_UNSPECIFIED); + ret = ldq_le_dma(&address_space_memory, addr, pte, MEMTXATTRS_UNSPECIFIED); if (ret != MEMTX_OK) { info->type = SMMU_PTW_ERR_WALK_EABT; diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c index 932f0096974..1e9be8e89af 100644 --- a/hw/arm/smmuv3.c +++ b/hw/arm/smmuv3.c @@ -102,20 +102,34 @@ static void smmuv3_write_gerrorn(SMMUv3State *s, uint32_t new_gerrorn) trace_smmuv3_write_gerrorn(toggled & pending, s->gerrorn); } -static inline MemTxResult queue_read(SMMUQueue *q, void *data) +static inline MemTxResult queue_read(SMMUQueue *q, Cmd *cmd) { dma_addr_t addr = Q_CONS_ENTRY(q); + MemTxResult ret; + int i; - return dma_memory_read(&address_space_memory, addr, data, q->entry_size, - MEMTXATTRS_UNSPECIFIED); + ret = dma_memory_read(&address_space_memory, addr, cmd, sizeof(Cmd), + MEMTXATTRS_UNSPECIFIED); + if (ret != MEMTX_OK) { + return ret; + } + for (i = 0; i < ARRAY_SIZE(cmd->word); i++) { + le32_to_cpus(&cmd->word[i]); + } + return ret; } -static MemTxResult queue_write(SMMUQueue *q, void *data) +static MemTxResult queue_write(SMMUQueue *q, Evt *evt_in) { dma_addr_t addr = Q_PROD_ENTRY(q); MemTxResult ret; + Evt evt = *evt_in; + int i; - ret = dma_memory_write(&address_space_memory, addr, data, q->entry_size, + for (i = 0; i < ARRAY_SIZE(evt.word); i++) { + cpu_to_le32s(&evt.word[i]); + } + ret = dma_memory_write(&address_space_memory, addr, &evt, sizeof(Evt), MEMTXATTRS_UNSPECIFIED); if (ret != MEMTX_OK) { return ret; @@ -298,7 +312,7 @@ static void smmuv3_init_regs(SMMUv3State *s) static int smmu_get_ste(SMMUv3State *s, dma_addr_t addr, STE *buf, SMMUEventInfo *event) { - int ret; + int ret, i; trace_smmuv3_get_ste(addr); /* TODO: guarantee 64-bit single-copy atomicity */ @@ -311,6 +325,9 @@ static int smmu_get_ste(SMMUv3State *s, dma_addr_t addr, STE *buf, event->u.f_ste_fetch.addr = addr; return -EINVAL; } + for (i = 0; i < ARRAY_SIZE(buf->word); i++) { + le32_to_cpus(&buf->word[i]); + } return 0; } @@ -320,7 +337,7 @@ static int smmu_get_cd(SMMUv3State *s, STE *ste, uint32_t ssid, CD *buf, SMMUEventInfo *event) { dma_addr_t addr = STE_CTXPTR(ste); - int ret; + int ret, i; trace_smmuv3_get_cd(addr); /* TODO: guarantee 64-bit single-copy atomicity */ @@ -333,6 +350,9 @@ static int smmu_get_cd(SMMUv3State *s, STE *ste, uint32_t ssid, event->u.f_ste_fetch.addr = addr; return -EINVAL; } + for (i = 0; i < ARRAY_SIZE(buf->word); i++) { + le32_to_cpus(&buf->word[i]); + } return 0; } @@ -569,7 +589,7 @@ static int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste, return -EINVAL; } if (s->features & SMMU_FEATURE_2LVL_STE) { - int l1_ste_offset, l2_ste_offset, max_l2_ste, span; + int l1_ste_offset, l2_ste_offset, max_l2_ste, span, i; dma_addr_t l1ptr, l2ptr; STEDesc l1std; @@ -593,6 +613,9 @@ static int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste, event->u.f_ste_fetch.addr = l1ptr; return -EINVAL; } + for (i = 0; i < ARRAY_SIZE(l1std.word); i++) { + le32_to_cpus(&l1std.word[i]); + } span = L1STD_SPAN(&l1std); From patchwork Tue Jul 25 10:25:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 706133 Delivered-To: patch@linaro.org Received: by 2002:a5d:464f:0:b0:317:2194:b2bc with SMTP id j15csp98454wrs; Tue, 25 Jul 2023 03:25:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlH6SuhFxB2doRSrhHMuxna+9mrRPwOvnyop+lYkHsFZW08xQzRYu1f8fSoDWS8ajBdQyOS/ X-Received: by 2002:ad4:5dee:0:b0:636:a374:4ba1 with SMTP id jn14-20020ad45dee000000b00636a3744ba1mr2116292qvb.14.1690280743366; Tue, 25 Jul 2023 03:25:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690280743; cv=none; d=google.com; s=arc-20160816; b=IPSv2PzltfGjbzv6UgAyyZXMpC5eLfPD4WL9zOyXVCHojUHUzgJfjuFyE4752LESoc WZibhDQ28OgkFrZhqO5OVwACoEZNAYCElGLhhUamon7IaVjQZwOAIP6LG7GdQckWqvBz OuXQ5sTXLigTmPURJh9WJLDJ5kb2ZSB0B5XZHYg1pF0AjpW7mWomOPoJxAnwFGkzesXC lfLuFptS76iVm4/+AvfCWDFIKwN1dKc1u5WQ5hGOziX9nD5pN42DtWMtIj/pmTr9sl7w NZMwJVI9HS5mzL8VvH+TabREiBDytui7AwwKxuBhTR6jfais7M32G2lNFnrarhqjauGR ZZSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=41mRUnFQ63Ww9Yf+9V896kHykCP+IOApwo6ThctCswg=; fh=bFDrUYhlTVi/QyetgXx/byg2+yO/22Hp9SjwoefyKLk=; b=iRtIOiUBXuE1vQPNdMHrd/LqHPOP7pMuSODFKXx7LNnccJkc0lNJO6FijwrddtU9X1 akFNDidq8+pe4ueUaYzR0Tv7WZWbq+CX4doEFUoAHh/11b7hV4mpyyZOND7ccuVKinQX ayu7T0we/kvQx7BezhOJSiP/Hn9PljeNc8JDM2U2bxvO+ZZf3zlOCSn9sl01fwUqzlS1 n9FCjEGoClvtawWiagRgzYMZRQiy6c8Eti6NabXl2APSoMPN2B0oaumpESfZXVnvpWi1 VQEUpo10Q4EXHgv8tdtRV7HGP9HLf7sK8lkkVux/WO72XwEeCU77n3mFn7KvJhJSvdo9 mhoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KcgvwJwJ; 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 z19-20020a0cf253000000b0063017dd5404si4231385qvl.149.2023.07.25.03.25.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Jul 2023 03:25:43 -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=KcgvwJwJ; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOFEN-0000KD-98; Tue, 25 Jul 2023 06:25:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOFE5-0000Gc-ML for qemu-devel@nongnu.org; Tue, 25 Jul 2023 06:25:11 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qOFE3-0007VC-Fw for qemu-devel@nongnu.org; Tue, 25 Jul 2023 06:25:09 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3fb4146e8deso53871935e9.0 for ; Tue, 25 Jul 2023 03:25:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690280706; x=1690885506; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=41mRUnFQ63Ww9Yf+9V896kHykCP+IOApwo6ThctCswg=; b=KcgvwJwJxFBsRZs3JzMUJP6BI9LNwdYnMiL/ogUeqirQH8im3pWDE5HA4BWBgeGJ2y q3MzNn1gMxx0XyUBiixhgcSiVQ3KLAT/Qw1R6GWbIMppjtJrI1GPkd1yaGR9A90HrJFA lPo7DxZEW+7yu0sKNt1BYoDatzuHUXYBJslHAP1uwtCE+yDtVJ5YGp7hyUwrKdDzjd+X JqmzrHtGBucgRSUBOBPFS0BID8tdrq7VZtrG+pyj4qeGoKEGck7JIhxaQR3aY+lmPx3i NC1Gk4/T9pAsjk2qfVrPRblJ2d4snEsFJVSDHlfBFP1lve+lMmgyA3Ld56aDAY2Tmspx kDow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690280706; x=1690885506; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=41mRUnFQ63Ww9Yf+9V896kHykCP+IOApwo6ThctCswg=; b=PCHTJGRH7G8c0VQfx08eDTRZf4+mndEynqLKlddejBlmckM1hjC643GQ9I63pHSdG+ VOUX5/Dpi8i4ulRVB3X9CnDoYL/OKaxMXs439HGaXrDhFrA4HT3lSE+L2s+n1AbmrjHt PEcmKzbXxqV3Yyv0upqKD6Dui1gbT4ymH+HAZT6HTfIjO+G+TMj7C5Dz4DZqJ8Ag4CID Sx9qMrSaoc9+p83Jv4GJPQL3CkMndIp2ivU2NirRWCs7SFr36VKusI8E1j/mtVRdpxqV anV6GkR3O/76j8DgzEoi0a1F16P+A1yAlaN5pgz/jKZ/uk+rZoqJiJsq3XqWokdDElyE Cc7w== X-Gm-Message-State: ABy/qLYk+YeTPvC0b8s8Iyido3Sg0jiAVGw5gxwBEq9WHdCrAsJTUauM dZW8PAFJKP2VEPMo3VWll894kpWtWqlb6XFuaDU= X-Received: by 2002:a7b:cd1a:0:b0:3fd:4880:2aa5 with SMTP id f26-20020a7bcd1a000000b003fd48802aa5mr5986334wmj.28.1690280706044; Tue, 25 Jul 2023 03:25:06 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id u19-20020a05600c211300b003fbc30825fbsm12567185wml.39.2023.07.25.03.25.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 03:25:05 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 2/5] scripts/git-submodule.sh: Don't rely on non-POSIX 'read' behaviour Date: Tue, 25 Jul 2023 11:25:00 +0100 Message-Id: <20230725102503.2283907-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230725102503.2283907-1-peter.maydell@linaro.org> References: <20230725102503.2283907-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The POSIX definition of the 'read' utility requires that you specify the variable name to set; omitting the name and having it default to 'REPLY' is a bashism. If your system sh is dash, then it will print an error message during build: qemu/pc-bios/s390-ccw/../../scripts/git-submodule.sh: 106: read: arg count Specify the variable name explicitly. Fixes: fdb8fd8cb915647b ("git-submodule: allow partial update of .git-submodule-status") Signed-off-by: Peter Maydell Reviewed-by: Daniel P. Berrangé Reviewed-by: Philippe Mathieu-Daudé Message-id: 20230720153038.1587196-1-peter.maydell@linaro.org --- scripts/git-submodule.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/git-submodule.sh b/scripts/git-submodule.sh index 335f7f5fdf8..bb1222c7727 100755 --- a/scripts/git-submodule.sh +++ b/scripts/git-submodule.sh @@ -103,7 +103,7 @@ update) check_updated $module || echo Updated "$module" done - (while read -r; do + (while read -r REPLY; do for module in $modules; do case $REPLY in *" $module "*) continue 2 ;; From patchwork Tue Jul 25 10:25:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 706136 Delivered-To: patch@linaro.org Received: by 2002:a5d:464f:0:b0:317:2194:b2bc with SMTP id j15csp98756wrs; Tue, 25 Jul 2023 03:26:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlEzEi7pKhQ/nQlcVVRWFN4E6uDVST1sF7WWZmC4HJKWIZY2MUgOF8w+YeSPh3Op2LteaZP4 X-Received: by 2002:ac8:5907:0:b0:403:be93:678 with SMTP id 7-20020ac85907000000b00403be930678mr2866670qty.6.1690280791178; Tue, 25 Jul 2023 03:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690280791; cv=none; d=google.com; s=arc-20160816; b=H/ICqMn2/0YQMXKH0Ocq16PZjog0JLdbBN/6QHCT7ucvGGpE+iZdu2a6m+sTk4U6Yd jlAgQ4Kv/xB69RhUdJk1dM4e1JLB3kBSFVFOLP9+SsKJodn+PA7iKbZqryHbOzXGlIje w3nrIauNurjaCezPDgKevljceyygCVaPMleoXoBpBCj6zbqJZtqxcFZuRlFpai+uzEUP d1hQ7Q/qIDRp+clFgY5+sewy6JwMy28wNvPohdbP2jqGD+MHTM+tWKi+23vODfZEe9CH 4MiHznuC5vRNMz1TFYFqoMWF22e9Dt1ZhDbiU67dqqg1ZJfrL5Brll9hzAvarEHaTXh7 k31g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=LnZsXBbIrTDKV2igH/1OazM17WZlfyrZZU/qtmoKHRk=; fh=bFDrUYhlTVi/QyetgXx/byg2+yO/22Hp9SjwoefyKLk=; b=bXkTZiop9MrxbWqpU3uXCZCZFemO8C+EoEfM2oVWKbMPwAB3IiINk4JJe+a3eeaQt5 QXab5cvuPMrQLbQj5bWm97jCO0ufC7uRjwcYDUI/eiOQYognFotSFkfPJwvDuc6XfUW3 s1uGWlo2ncFhlkf4D4K0Nj8WXeXZsSDuiEIBxn1LT5j9f9vp5sc4WX8PfSqEI/2WHGVa 53HEppE+gKxO/Y1Pg3W5ycs8OvddO/DE+OdXToJqmdNqshG/vO/4roA8thhqCayIAheY w9h1eLYx0R8gIcHDBb/FVbjUT2bngOHbu70RfyCBtKiklCoAL5hHE9iEUdy+uB+qAkKu Lh+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZvYu7mZq; 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 l7-20020a05622a050700b00403abf5b44csi6118485qtx.264.2023.07.25.03.26.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Jul 2023 03:26:31 -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=ZvYu7mZq; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOFF9-00010E-42; Tue, 25 Jul 2023 06:26:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOFE7-0000Gf-BD for qemu-devel@nongnu.org; Tue, 25 Jul 2023 06:25:11 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qOFE5-0007Vd-Bj for qemu-devel@nongnu.org; Tue, 25 Jul 2023 06:25:11 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-4fbaef9871cso8046729e87.0 for ; Tue, 25 Jul 2023 03:25:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690280706; x=1690885506; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=LnZsXBbIrTDKV2igH/1OazM17WZlfyrZZU/qtmoKHRk=; b=ZvYu7mZqBJG9XkWG7bzaqOpKSXZ6lwggmnmsExjR3r3e7tOJk+7Wgi3jm30EwTW4pC oTbEmX5MrOU1HcnhaaBjI8YNfjVyLnZRyBiduV0UENuGXpRqgx0WBr9f+mVDMQPz1Dxj mYTBYkqlrs8v0wqN74F+OPUnle0XHLDQsSF3uoYQ9m4vg/CMbG9Rz6WREse1PNu4pbK6 AoQVj7wJLv5KV5GT4yjuBN9VXP8U2ZsH7uCUhwTddC3l3QAv1HwaSzYx4wwTFZ7QijFm d2mva17VOoenhWDjcA3s/r74lBE5QUmbdAuzLCd5ZEHCATXKnUn5EnTTtAVPVk3kZtK1 B+Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690280706; x=1690885506; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LnZsXBbIrTDKV2igH/1OazM17WZlfyrZZU/qtmoKHRk=; b=fHIpJv/IoUDbZx3jn9Tcf3w6bRBRVb66YBBAti+uXlV86fmec3w+kZgRXTtN7aKCSt gkVbe/L8seQyFJSrUM5xPPKEim4KhYnWh41jatrZusMZglwF/Bf7gydhj5umYIgzxK4O crRpI8ytQ50sK/E9EV5Ojd2KkP9geT6hyLZOxRv/9ofrfZcwCU2idYcfCHrd4NkzKKsg Wet29/DAPDRQWxxtT81dOFMRTvSqSU8RsjS/OZxypLdIxYeKkLfkWzcItO180K73awWk oi1pxsQjQTOjdv4lfuGzSmd204K1qBrhebzyYbJoTqi8857Vd6Q1QHoiVtumIoiQvWOy ZXMA== X-Gm-Message-State: ABy/qLas4U+eNYXeOpP8towNKctDALQ7KA46DmdeJa1nOaZy5oDWlhic rk1VcnoPY/5ytTGCHjBlkxCtUDUyt1K33r1UbCo= X-Received: by 2002:a05:6512:39c5:b0:4f9:69af:9857 with SMTP id k5-20020a05651239c500b004f969af9857mr7786560lfu.51.1690280706469; Tue, 25 Jul 2023 03:25:06 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id u19-20020a05600c211300b003fbc30825fbsm12567185wml.39.2023.07.25.03.25.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 03:25:06 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 3/5] target/arm: Special case M-profile in debug_helper.c code Date: Tue, 25 Jul 2023 11:25:01 +0100 Message-Id: <20230725102503.2283907-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230725102503.2283907-1-peter.maydell@linaro.org> References: <20230725102503.2283907-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x12b.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, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org A lot of the code called from helper_exception_bkpt_insn() is written assuming A-profile, but we will also call this helper on M-profile CPUs when they execute a BKPT insn. This used to work by accident, but recent changes mean that we will hit an assert when some of this code calls down into lower level functions that end up calling arm_security_space_below_el3(), arm_el_is_aa64(), and other functions that now explicitly assert that the guest CPU is not M-profile. Handle M-profile directly to avoid the assertions: * in arm_debug_target_el(), M-profile debug exceptions always go to EL1 * in arm_debug_exception_fsr(), M-profile always uses the short format FSR (compare commit d7fe699be54b2, though in this case the code in arm_v7m_cpu_do_interrupt() does not need to look at the FSR value at all) Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1775 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20230721143239.1753066-1-peter.maydell@linaro.org --- target/arm/debug_helper.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 8362462a07e..abe72e35ae6 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -21,6 +21,10 @@ static int arm_debug_target_el(CPUARMState *env) bool secure = arm_is_secure(env); bool route_to_el2 = false; + if (arm_feature(env, ARM_FEATURE_M)) { + return 1; + } + if (arm_is_el2_enabled(env)) { route_to_el2 = env->cp15.hcr_el2 & HCR_TGE || env->cp15.mdcr_el2 & MDCR_TDE; @@ -434,18 +438,20 @@ static uint32_t arm_debug_exception_fsr(CPUARMState *env) { ARMMMUFaultInfo fi = { .type = ARMFault_Debug }; int target_el = arm_debug_target_el(env); - bool using_lpae = false; + bool using_lpae; - if (target_el == 2 || arm_el_is_aa64(env, target_el)) { + if (arm_feature(env, ARM_FEATURE_M)) { + using_lpae = false; + } else if (target_el == 2 || arm_el_is_aa64(env, target_el)) { using_lpae = true; } else if (arm_feature(env, ARM_FEATURE_PMSA) && arm_feature(env, ARM_FEATURE_V8)) { using_lpae = true; + } else if (arm_feature(env, ARM_FEATURE_LPAE) && + (env->cp15.tcr_el[target_el] & TTBCR_EAE)) { + using_lpae = true; } else { - if (arm_feature(env, ARM_FEATURE_LPAE) && - (env->cp15.tcr_el[target_el] & TTBCR_EAE)) { - using_lpae = true; - } + using_lpae = false; } if (using_lpae) { From patchwork Tue Jul 25 10:25:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 706138 Delivered-To: patch@linaro.org Received: by 2002:a5d:464f:0:b0:317:2194:b2bc with SMTP id j15csp98917wrs; Tue, 25 Jul 2023 03:26:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlF8qAxlqzgPSAXTw9TOdH4z4PXLqQ0f6f5t3+K8OG5UcZFDKl1ArIhfs89Aj47dxL0zPjCb X-Received: by 2002:a05:620a:a4a:b0:767:2076:5bee with SMTP id j10-20020a05620a0a4a00b0076720765beemr2376460qka.9.1690280816137; Tue, 25 Jul 2023 03:26:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690280816; cv=none; d=google.com; s=arc-20160816; b=FHhbawXfx/EgY/BSwqWorDeHegTRj363oKZ/SAXVnSbg9lv3siGhWOA+S0GVr5U5Gp F6eH9cLf/DhKGr+XCZ7fshnu3P+mEXk/3+ePxLHR8ik+8ESI+0gMvDm0mvuHvChNiiz2 dL25VHc0CuSSJmLR3RhIK+Cb4lD7XQk7Z/K41m69ECjINu70ljJcpUIgeqLLoM0pDT5X AHHOHXrlW1xWtWLYOWhsXCW4vhFsHnhCtX1+S5vprb9H4Kj4DjSt7dzuaaJiPUYREgMF lVnf5iC64Gt9d4igQIvE2DpjILcwYeOTyy0HK7gmoGD5jm4T9hMxGl49uC3PXxwEqP1R 8lCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=LicjyZN3b/YUo5rE9Rcv6mrB/LPasqs2dSTgyc7oBvU=; fh=bFDrUYhlTVi/QyetgXx/byg2+yO/22Hp9SjwoefyKLk=; b=RsUjH1YK0DNlTq0J2Muedqbejyj7LSOheraEQOsQgVPdKXZfkE5Yhm4eBQNtm55uKW irRMoS6+g/GQrBmd/E8nMaxCxcNGShsY9YmP+xLMq86AVQniWOlcjmwqyiUx7/ZELs2u jlYuCZ31tfTK6Moj8LWnbqzTKYito4YSngFIiycsap9y4ipoQ2LVP0A5yFH8cI1vCviN MXMbP9TZHwAiZGe4sJAgRZWxoGmmTzQzRcJ5Xnmm5YFuSrKl8h7ehEkwYqG8IU7owYz1 ec9d3VHR54fxpTyj2h2y7IT3gzfe31BlIb86D9hRn9bwtJjcNpExAsdJA7CParRPuVsr 17+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="JgA3qk/R"; 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 s125-20020a372c83000000b00767e5d15d79si6160375qkh.34.2023.07.25.03.26.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Jul 2023 03:26:56 -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="JgA3qk/R"; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOFFD-0001Ut-NL; Tue, 25 Jul 2023 06:26:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOFE8-0000IK-8k for qemu-devel@nongnu.org; Tue, 25 Jul 2023 06:25:13 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qOFE5-0007Vp-Mh for qemu-devel@nongnu.org; Tue, 25 Jul 2023 06:25:11 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fc04692e20so52686205e9.0 for ; Tue, 25 Jul 2023 03:25:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690280707; x=1690885507; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=LicjyZN3b/YUo5rE9Rcv6mrB/LPasqs2dSTgyc7oBvU=; b=JgA3qk/RdInWcQKiQ0PPOOOrSkEaeSLJBucMWy7/HIn+Y001VkNGy9sk3qnojVFypD 7QE/SqE6zlGUBgvCumB6ozGVAseucr4Dat82QHPjGInn7A+Do4exeOHn67x1B9Xwo2qs DuTIk+Vd4tqQz+FjLBNgIPO9i4uTNIQ1wfcO/woVQR/vWmkoYJaoTdNL9wc862wYcSoU cbEkUlpPZmnH7HCYJE9G3xbx9RTOsXRE51oGvPmmw7fZkzZboq6wd7xut3eO9YtQFUoD Zc5Q7wapBM8Z56y/dXMu2LpXlvnONc9tU9Vp7FVTYR5DWZICyFWIE0hNK8fW+3zhKiPU 5ajg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690280707; x=1690885507; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LicjyZN3b/YUo5rE9Rcv6mrB/LPasqs2dSTgyc7oBvU=; b=MVyDlEK89ktJ5x9o26htlsRkNfz7gh0K+2D9aZNHbZ7XqW2UMEhvver8KqTbvb1oC7 6vPjZxwrDMEcV8QwwzJBHWXyE4uOCquR7Z/iRmssdkHwc6M9++yQ2+NaWr5vuUWJtRmC MB6dLtowuuHfiqAWuDGKOZ41Q74P/uRoLiVLbkStTwizx5C+0MYBKuiyuQfgxGtEIxXa UBac25QvchTpgXZd/YJydSlNCOUwFArFAqKX6hCQUFPk0CjGUPNrsZSGEwQaAOV7nL5K u0XApK3wTKo7dzbAJdlp6wB27aM3FkQTTCPPDHs/4KhYyQW/SFc0FcXOUrliiSFriHq4 APrQ== X-Gm-Message-State: ABy/qLYPWzNKasjJ9qixQPIX3rwjEGJuatnU+W4NJLrReVbdPIUofZIp YeDL4UQaIABUY4675D9vCeVksn/Wn0+5/BsUTc8= X-Received: by 2002:a1c:6a13:0:b0:3fb:b3aa:1c8a with SMTP id f19-20020a1c6a13000000b003fbb3aa1c8amr9888741wmc.16.1690280706906; Tue, 25 Jul 2023 03:25:06 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id u19-20020a05600c211300b003fbc30825fbsm12567185wml.39.2023.07.25.03.25.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 03:25:06 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 4/5] For curses display, recognize a few more control keys Date: Tue, 25 Jul 2023 11:25:02 +0100 Message-Id: <20230725102503.2283907-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230725102503.2283907-1-peter.maydell@linaro.org> References: <20230725102503.2283907-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Sean Estabrooks The curses display handles most control-X keys, and translates them into their corresponding keycode. Here we recognize a few that are missing, Ctrl-@ (null), Ctrl-\ (backslash), Ctrl-] (right bracket), Ctrl-^ (caret), Ctrl-_ (underscore). Signed-off-by: Sean Estabrooks Message-id: CAHyVn3Bh9CRgDuOmf7G7Ngwamu8d4cVozAcB2i4ymnnggBXNmg@mail.gmail.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- ui/curses_keys.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ui/curses_keys.h b/ui/curses_keys.h index 71e04acdc75..88a2208ed18 100644 --- a/ui/curses_keys.h +++ b/ui/curses_keys.h @@ -210,6 +210,12 @@ static const int _curses2keycode[CURSES_CHARS] = { ['N' - '@'] = 49 | CNTRL, /* Control + n */ /* Control + m collides with the keycode for Enter */ + ['@' - '@'] = 3 | CNTRL, /* Control + @ */ + /* Control + [ collides with the keycode for Escape */ + ['\\' - '@'] = 43 | CNTRL, /* Control + Backslash */ + [']' - '@'] = 27 | CNTRL, /* Control + ] */ + ['^' - '@'] = 7 | CNTRL, /* Control + ^ */ + ['_' - '@'] = 12 | CNTRL, /* Control + Underscore */ }; static const int _curseskey2keycode[CURSES_KEYS] = { From patchwork Tue Jul 25 10:25:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 706137 Delivered-To: patch@linaro.org Received: by 2002:a5d:464f:0:b0:317:2194:b2bc with SMTP id j15csp98850wrs; Tue, 25 Jul 2023 03:26:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlFnoXHbmOQjcX7s8SpPJNewGdHCHFF6KjQAUhzbr5TW/V+r9v73ITxBBzOO+kYDWuXFutcJ X-Received: by 2002:a05:622a:1703:b0:403:c667:e691 with SMTP id h3-20020a05622a170300b00403c667e691mr3087540qtk.22.1690280807780; Tue, 25 Jul 2023 03:26:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690280807; cv=none; d=google.com; s=arc-20160816; b=Y0LtotfAgMDOrDMl2hthHJOkBf4cyPUgScvG7QwrDaNGOW0XszR64wv+ScpRonsSIn Tqr4/oOqRcLUR5K/W3Kj2V12bcJboZg6grS6hIdZREPFfc2+5EIWE6bzF6oMm4vqpFWU ytAwZEEqNd5bvlUTmGHwWcyxJUVYbGbqGxnYkDcNsvKCC4kyFmSNjZk+5yl3vU2cr5k6 WURaUiX3s5pAqX/25t/BUq+yO6sXsuBxj3vIwqVVEbDJiETRqzkCbIBKB3I3V9UvD1LG 5V4k1EKpiT274LvYixH4/tRISP67QrBhL5KRGUKPh2KINmttjV3cSSGvFViEg32piKAD /cCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=9C6PfLlU2O818ZwPOAqAi3d27sGlX9QQgbc+eDlrhGY=; fh=bFDrUYhlTVi/QyetgXx/byg2+yO/22Hp9SjwoefyKLk=; b=f8BPnSShfTsUP2QOH3HhrFMgQLVWciilMdpk3R+G6YKbbUD1XO57AXKFX/L64v2mVL WqNwtVMUP2sXoKB9iRwPSHak3g/ZPA8BT3ZzRoDB/MRnHSCglktznDLaPRMpyn1xZUrD QOmghHnWjSDCQqJFaK/5Py5PI05YP1KuKQWoTH8BU3j15nGb87eG6E40Q4bvE2Ra2T9s +i0GCZcr9LS1w5d89wN8WBp51qux6syaQHLKAtLbzJuzWJZdO9BUYL9+HoWh9phYHnU/ xjf84aEnEZcKU/cb1MdA2pQrHZTV5Nf8SvaZ0B1l5X+jKPFkqaGaZi6SlXsSs6/GV5y5 a0xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DtiJDRKz; 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 n6-20020ac85b46000000b0040696bcc9f5si2670232qtw.281.2023.07.25.03.26.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Jul 2023 03:26: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=pass header.i=@linaro.org header.s=google header.b=DtiJDRKz; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOFFE-0001Xp-Be; Tue, 25 Jul 2023 06:26:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOFE8-0000Ix-CC for qemu-devel@nongnu.org; Tue, 25 Jul 2023 06:25:13 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qOFE5-0007WG-Q2 for qemu-devel@nongnu.org; Tue, 25 Jul 2023 06:25:12 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fbc63c2e84so53543925e9.3 for ; Tue, 25 Jul 2023 03:25:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690280707; x=1690885507; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=9C6PfLlU2O818ZwPOAqAi3d27sGlX9QQgbc+eDlrhGY=; b=DtiJDRKzQ6LC69Z7UhI7WOfXygH36DCkqUZqSr6AB/A8gX96oYoxuxboOlegc3Npbh dVu98nazkFFEbvkvmAv3oIWTT3v92+tRWnJsvdM3PtHRzy0JftggZ7Byca49ORk4hJy6 rInsc809qsj05DODNJ83TBjrVImyJ+qQ024xgqdg0TW45JBjumofd0GC4FAJwE2HfC+Q q8+QCVY/Ve7PPwbbPvSnzHFUMS7bQhF/H+YlYUbv0CHR+LLkDQ+IW+T4IykP4tFuLrJR WEumbDzp8z/0spIjITYrdg5ZO6FMweF7cI1WYvtL5HT2Q5/f72eIhg6e9xIcNB+W6tJj Gr1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690280707; x=1690885507; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9C6PfLlU2O818ZwPOAqAi3d27sGlX9QQgbc+eDlrhGY=; b=Vl5IVPUrGbYT2NH8xku2yuTPBU4UlvnZ6fJYbaaHLoBMKhBswRVGH/DZiy7lNyRJyb 4W4G8g6+SXfCt+FsXUZiR/llCB8jv79tpJzoiGvTZlSTXhabO7ZI/ufob7LTmKm+VLuC tSoH2+RypdYnJkB1JRLtu7w/N0YjPoQmwfUF+dor0xEUuFxEHDx2MNCd6FAhqX2IajZe JAczkh8wJqUvJ/9IZqUxX2WNoF+JKQHq+O5O5GHhoogUO4qKKchMG2OzkKc5K+BnoSzQ 09RMfE2jtNfSMkTzM4KGlbTuGYQnBgpw6RIMIAnzOSF6i7VRxrvAsRca5JPKYq02wupt yrTA== X-Gm-Message-State: ABy/qLbUXCWb6svoBNpVkmvCJS7EatPH+ENJPk8YDL7++buMuoJk6tWf BODGKxQO58QAxf7w8F0JXJSbR8qOJrfOdGNK4AY= X-Received: by 2002:a05:600c:40c:b0:3fb:dd9c:72d2 with SMTP id q12-20020a05600c040c00b003fbdd9c72d2mr10012662wmb.31.1690280707298; Tue, 25 Jul 2023 03:25:07 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id u19-20020a05600c211300b003fbc30825fbsm12567185wml.39.2023.07.25.03.25.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 03:25:07 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 5/5] tests/decode: Suppress "error: " string for expected-failure tests Date: Tue, 25 Jul 2023 11:25:03 +0100 Message-Id: <20230725102503.2283907-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230725102503.2283907-1-peter.maydell@linaro.org> References: <20230725102503.2283907-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The "expected failure" tests for decodetree result in the error messages from decodetree ending up in logs and in V=1 output: >>> MALLOC_PERTURB_=226 /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/x86/pyvenv/bin/python3 /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/scripts/decodetree.py --output-null --test-for-error /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/x86/../../tests/decode/err_argset1.decode ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/x86/../../tests/decode/err_argset1.decode:5: error: duplicate argument "a" ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― 1/44 qemu:decodetree / err_argset1 OK 0.05s This then produces false positives when scanning the logfiles for strings like "error: ". For the expected-failure tests, make decodetree print "detected:" instead of "error:". Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20230720131521.1325905-1-peter.maydell@linaro.org --- scripts/decodetree.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/decodetree.py b/scripts/decodetree.py index a8a6cb69cda..e8b72da3a97 100644 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -134,6 +134,10 @@ def error_with_file(file, lineno, *args): global output_file global output_fd + # For the test suite expected-errors case, don't print the + # string "error: ", so they don't turn up as false positives + # if you grep the meson logs for strings like that. + end = 'error: ' if not testforerror else 'detected: ' prefix = '' if file: prefix += f'{file}:' @@ -141,7 +145,7 @@ def error_with_file(file, lineno, *args): prefix += f'{lineno}:' if prefix: prefix += ' ' - print(prefix, end='error: ', file=sys.stderr) + print(prefix, end=end, file=sys.stderr) print(*args, file=sys.stderr) if output_file and output_fd: