From nobody Mon May 20 18:59:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689598616; cv=none; d=zohomail.com; s=zohoarc; b=URZIhcHsEI57jk+vFg/GMda7ZlUWVaRyBQwBpDOiInywZ0kP/jyEnAZu3IioJ7saK1ZYe9f/8qiUOtgIQlverBr1zi09+WZeZYqZKXMrTKDVrZKLA/bDXAMX82VtaOBdydfb6JNyQ7wpl+FRtNqTvEHewNAaxDvMvRVz8h8kKYk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689598616; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Mgagk+e6MpB3ekgnXPZSkT6Pl5UPW0SEYnhBOt/GBFg=; b=nJ/b7pYRhOKbrHmIB57LCMf6rW+4PSh2IRg5kymRz27rDov/G/xfju/qQ7jQRDrGWtSxfXv/eT+pCBHCQegtjMVKl23tbC5s0wMgd0W68PAAETu0iiC/8bN60e2JY0kPdWY6mU2r+ZYRQxV596gflEyZT0boDt6ubG3km/sYlBM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689598616142373.0767209343436; Mon, 17 Jul 2023 05:56:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qLNgr-0002VT-Jy; Mon, 17 Jul 2023 08:51:01 -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 1qLNdo-0008Q6-W6 for qemu-devel@nongnu.org; Mon, 17 Jul 2023 08:47:55 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qLNdm-0008T3-4H for qemu-devel@nongnu.org; Mon, 17 Jul 2023 08:47:52 -0400 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-314172bac25so4371172f8f.3 for ; Mon, 17 Jul 2023 05:47:49 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v16-20020a5d6790000000b003112ab916cdsm19337737wru.73.2023.07.17.05.47.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 05:47:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689598068; x=1692190068; 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=Mgagk+e6MpB3ekgnXPZSkT6Pl5UPW0SEYnhBOt/GBFg=; b=wzCedMEseK9OTNg8QzVTmoGR9agSjno1fRQ1ZAVtbI77K/AV2mrrOrsVLkAeseCvAz fwuT/5ua9E43cEcSRKfI2wRNKLcdCN7/DgpEScZtEwAFbIcdnr6Y2eNkBqodMKoU3wRJ QJaoLvkVqVAcIv3MAcKgRbNyjh8Mgdnak4PfCBKwjJ4xveHAW7Z4MjVaurFv+ho3AFbV i6LP7byXDBVF3cmlVRqC3WEeO5y7i6+y7T44ClcczX1RofbIy8nvQ+EZw7glVZQFK932 ImacDfzmJitd7fsvScxs668crL2y5zmWQi7U9HSqF9uNRwRPLD9Tm4i8DsI/YX+fRZun Lz0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689598068; x=1692190068; 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=Mgagk+e6MpB3ekgnXPZSkT6Pl5UPW0SEYnhBOt/GBFg=; b=J9yegF//1B50ZcEb2hCxwvNzg4dyC8wHvm7xTYHfNhHA6+bjyU225+Sj8WM86U/dsM 02pTokq+XsIph3wtcZzgPSFtC/0wU46XwONdWNx7vJE73DX7jdsqKRTdOBTbsW8Dit70 KfCUjS6B5WHxGfxxkX0qs/p4WtexR4ZT8o9B7IBdXWeGD0LZm+O+BVqQaJD06ZghANOa aOUlkn8BbhMe4qhac2snM6usiuGFdc85Vm0BbaEzocoaQWcfYmC3HE83L9kvVyKKF/wr QoEYHFKUuirNtFWhb0mwAT5jtabFCHrTckZ+HsRmM/INEvGAVyQLZfuJdM6kX2ha1vrq dXfQ== X-Gm-Message-State: ABy/qLaJUo1YexzeLh8QmHIfK3aKPazAnt6XNJchw9beHy2bLtj+TWnE Naw+zRL1AMCIghonU9wsmhnQVDHYg3TbFgZcJws= X-Google-Smtp-Source: APBJJlGOW9EcncmODijF1etGkA8Uu8pvtnwAUGXbJ6fQ+KIxZIhLU5HeSuZ65hATSvONFZSSfbK7Gw== X-Received: by 2002:a5d:50c8:0:b0:314:20ee:2de7 with SMTP id f8-20020a5d50c8000000b0031420ee2de7mr9098085wrt.11.1689598068398; Mon, 17 Jul 2023 05:47:48 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 1/7] hw/arm/sbsa-ref: set 'slots' property of xhci Date: Mon, 17 Jul 2023 13:47:40 +0100 Message-Id: <20230717124746.759085-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230717124746.759085-1-peter.maydell@linaro.org> References: <20230717124746.759085-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x433.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689598618114100001 Content-Type: text/plain; charset="utf-8" From: Yuquan Wang This extends the slots of xhci to 64, since the default xhci_sysbus just supports one slot. Signed-off-by: Wang Yuquan Signed-off-by: Chen Baozi Reviewed-by: Richard Henderson Reviewed-by: Marcin Juszkiewicz Tested-by: Marcin Juszkiewicz Message-id: 20230710063750.473510-2-wangyuquan1236@phytium.com.cn Signed-off-by: Peter Maydell --- hw/arm/sbsa-ref.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 64e1cbce171..bc89eb48062 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -611,6 +611,7 @@ static void create_xhci(const SBSAMachineState *sms) hwaddr base =3D sbsa_ref_memmap[SBSA_XHCI].base; int irq =3D sbsa_ref_irqmap[SBSA_XHCI]; DeviceState *dev =3D qdev_new(TYPE_XHCI_SYSBUS); + qdev_prop_set_uint32(dev, "slots", XHCI_MAXSLOTS); =20 sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); --=20 2.34.1 From nobody Mon May 20 18:59:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689598370; cv=none; d=zohomail.com; s=zohoarc; b=eAmanh5bcaxT9QYdOMDnoIBvHngm1Hq4Vr+RifIAb0uqApA1TSh33qtndDPXOl+qrdyeTD2nLh/Lw5NKEpY1HcTDJJTe1nlN6S1Fcsqn/yyGNdBkjBwcJ2F7wUt1zO6fJGIRc7QZxR8KhToGvrkdZ0viS12jFGju4izn0Y+1bYA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689598370; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+E+optEz0nYwCwN2hJQhLLatmGokjisG+592zq4NO/8=; b=i8LQ1fpzxCIvDhQ2TkMHpVXNetVg2FRD1Ha53ArISoW3s2hyqchJLHSD7N4md+q8r61hmgDcxZVeBbazfpcsAvt0oGK6Uf/Gv4RV4L2eN2u8+kCc15819lJuOZdfWURqYrn2jwK50COqK1h8rwlFAXJMQFXYL4URB3HoIv4sKQs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689598369895217.48142987987956; Mon, 17 Jul 2023 05:52:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qLNhw-00040X-Oz; Mon, 17 Jul 2023 08:52:09 -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 1qLNdr-0008RX-QA for qemu-devel@nongnu.org; Mon, 17 Jul 2023 08:47:58 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qLNdm-0008T5-Ag for qemu-devel@nongnu.org; Mon, 17 Jul 2023 08:47:55 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fbea147034so40886155e9.0 for ; Mon, 17 Jul 2023 05:47:49 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v16-20020a5d6790000000b003112ab916cdsm19337737wru.73.2023.07.17.05.47.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 05:47:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689598069; x=1692190069; 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=+E+optEz0nYwCwN2hJQhLLatmGokjisG+592zq4NO/8=; b=Ivq7E0ZQ29pk7V0StaXJ8b61sMdqQG7h2pNDu7n3qZCpESOR97i9KtIqSq5rWL4Q6J N5ETYcURe6o6Wh5ZhV2DO/fzI/HhXIK+qZBeA3vHz07vy+zqwQsSNhMAOPrAh31D1Q7Z yTmVx5UAGfvpPp80LXbrSCjtdgYJD4QTi5TbMd2jNdULw67TV7IbYWVOpvbP/AFLGMdJ wTk8tzEaWuS7aFZgmt0aoBqXFAsNqirszpBIdXeuCB1GM4I31+eEmzK5NfiYR8nI2Sx4 zrqR6vElpyTfiboOnlrS4t5BfI9G88I3E92DpXh54TwzrKbufp8ZnIldh7DlPPJfUQYH pWtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689598069; x=1692190069; 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=+E+optEz0nYwCwN2hJQhLLatmGokjisG+592zq4NO/8=; b=IwMw/q70W0Cq21rsIJr4Acv7oFLvOsHTFcODGM/cJ61/b/j1yCNax1V4TDR99SDqBt Wvw6OcSowcJs/b70y1wuh38vjqzoOFOhFNggxI6kY+Ktn5wOUFb71bphOusMMjaniC2Y 28r71FX9Mi365hW23ZzZoWhQ+xQDzMkF/M4l/3Va7TxqvgeMsrWmcnFEt0syYhXE9e+l MXWfkAazM6f2VnvD9VWTxCzf8tB7jV7rfPG/g8S0mrfjYZnH7ASprplEfnCQXg98LUZY Z87p8ZeOfs5wJHtMYFyFGO52ywWQ9dF4EGET2G0c7OzqeHLHUQHPh+NTxBDTm1PFe7bg jCVw== X-Gm-Message-State: ABy/qLY+BJX4nmIpUwmnHgsv6QsVli5qNz/akAnpVk+e7gre3hLDz6D6 TSVJOfIJ2GBgpWbFe5jeoxWwvHETiGSfonqX5Kw= X-Google-Smtp-Source: APBJJlGB8EngbRkoTezBRAee1MVhdEobTe093wE2xbHG3Lu3tLqpZLwhYfYzULH9smMXvMyn71MPPQ== X-Received: by 2002:adf:eec7:0:b0:314:4925:1704 with SMTP id a7-20020adfeec7000000b0031449251704mr9840535wrp.6.1689598068791; Mon, 17 Jul 2023 05:47:48 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 2/7] linux-user: Remove pointless NULL check in clock_adjtime handling Date: Mon, 17 Jul 2023 13:47:41 +0100 Message-Id: <20230717124746.759085-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230717124746.759085-1-peter.maydell@linaro.org> References: <20230717124746.759085-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689598370535100003 In the code for TARGET_NR_clock_adjtime, we set the pointer phtx to the address of the local variable htx. This means it can never be NULL, but later in the code we check it for NULL anyway. Coverity complains about this (CID 1507683) because the NULL check comes after a call to clock_adjtime() that assumes it is non-NULL. Since phtx is always &htx, and is used only in three places, it's not really necessary. Remove it, bringing the code structure in to line with that for TARGET_NR_clock_adjtime64, which already uses a simple '&htx' when it wants a pointer to 'htx'. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20230623144410.1837261-1-peter.maydell@linaro.org --- linux-user/syscall.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 14641518262..c99ef9c01ef 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -11190,16 +11190,14 @@ static abi_long do_syscall1(CPUArchState *cpu_env= , int num, abi_long arg1, #if defined(TARGET_NR_clock_adjtime) && defined(CONFIG_CLOCK_ADJTIME) case TARGET_NR_clock_adjtime: { - struct timex htx, *phtx =3D &htx; + struct timex htx; =20 - if (target_to_host_timex(phtx, arg2) !=3D 0) { + if (target_to_host_timex(&htx, arg2) !=3D 0) { return -TARGET_EFAULT; } - ret =3D get_errno(clock_adjtime(arg1, phtx)); - if (!is_error(ret) && phtx) { - if (host_to_target_timex(arg2, phtx) !=3D 0) { - return -TARGET_EFAULT; - } + ret =3D get_errno(clock_adjtime(arg1, &htx)); + if (!is_error(ret) && host_to_target_timex(arg2, &htx)) { + return -TARGET_EFAULT; } } return ret; --=20 2.34.1 From nobody Mon May 20 18:59:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689598622; cv=none; d=zohomail.com; s=zohoarc; b=ch7Ycg3lfEwMBDI2CbmA5ttC8YJPYGRQZqQHSXnbCeiGjxtLjfNf6wtGPlAujGKYI2D4ENf9mdHz1pTASulrPMdtLSUbIcJvNJ/x2tkrg154DdIUtUl7msXkA8lnp8axrGoQeYIGbb6tng8qnFkTehGXZ1DHYcWHalzUl7LcHHM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689598622; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rRttNqKmS3icTZXVSo6Zoczfc48IgD7HZ3JpXissknE=; b=bMszoy4d8StVQV0P/IO3e6tjWB/KqQ7g9D1wCoqlRuQHui6gno4yfbDkNoa8WIuvitvTy7DUgSyefa2MfTxie/BhJtJNJDOR2+OLx5y4YUtXyqsPlPs1h3qK3Hxs+tI2Q1aRMY352FLq0ZxDKge9PQP+OxujKC8A4cABLT+6KGc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689598622487881.8349618194597; Mon, 17 Jul 2023 05:57:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qLNhs-0003fv-Ov; Mon, 17 Jul 2023 08:52:04 -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 1qLNe1-0008Uh-5p for qemu-devel@nongnu.org; Mon, 17 Jul 2023 08:48:12 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qLNdn-0008TJ-4R for qemu-devel@nongnu.org; Mon, 17 Jul 2023 08:48:04 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-315adee6ac8so4377235f8f.2 for ; Mon, 17 Jul 2023 05:47:50 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v16-20020a5d6790000000b003112ab916cdsm19337737wru.73.2023.07.17.05.47.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 05:47:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689598069; x=1692190069; 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=rRttNqKmS3icTZXVSo6Zoczfc48IgD7HZ3JpXissknE=; b=G0/XIEWu3T0nWigu0UIAgUQGtMXfORtfnsyVNTXFFOk6t57F0fs8zHr9UAXLWtMY6v WwYtJj544PV/eCp0JT/BwCMT9w947DqsngwrT56pK7ppeKNp7fZTPbVnNd31cQZCCxp1 DdTezd4hwa0G1r+kQ6YzxalMi04YEt4S8d0jZKsyG9lUCv4PQJxWdddpse+1mw9h0rSW RVb/Yv76laF2j7w381h42UGxeacZxpvap9EO6d+vAFFv7vx3RnYg7rFkbV4RG9nDtPTQ w/+CZlgS1SHI0Fdz4o5ypTQRh02Os/Jjvrk8rRKYopSxyFjdYAHw5WSC0GVZC5pzsfXf hyPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689598069; x=1692190069; 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=rRttNqKmS3icTZXVSo6Zoczfc48IgD7HZ3JpXissknE=; b=UKha7MjGBniUVDaXCGLSL0x5zm2E2cW6KknmB/cFXlccfG53//N1I9+oLAgukeJ4og xLRmZxh0GtXeMgt0peregVw4WTJ0w/SrPmWNz+/Gi6NFnaXboTAxdMJRisvRvJHZY07p LIruikDTTxVByYHoUYjvK482eizVGrzQcotM5oPUYc44EnqXaeCKTShmgGoPCjHL5qFj q+9Vz3PSIUL03UP5Y8Yr+u0jinQncxdJL3ZpB+I5vOkawA5OQjCFWNGH47bIjDVJm/8U qeZtCel4QpEvXJ8XWt26M8+SktwCtY06iljM3Y2xAt+efsGohkbR3ji3+Vg18JLNKox+ mLXQ== X-Gm-Message-State: ABy/qLZ3RZS4kKp2kE5zHmAOQwUejAUYaZqyPgcj8CdNKIUDUszCP2xq 9kSdOkZA/xqxAnB2BfwABcRpY08OqATQLt37pTQ= X-Google-Smtp-Source: APBJJlEc9PTm+7q6FHdY5kaafKdsCW6wfd1qqA6eLjUmrdtielEhYAKmn4tr0yFMOVk5ROxZ3/3e0w== X-Received: by 2002:a5d:452d:0:b0:315:ad03:a9e0 with SMTP id j13-20020a5d452d000000b00315ad03a9e0mr9488850wra.45.1689598069324; Mon, 17 Jul 2023 05:47:49 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 3/7] target/arm/ptw.c: Add comments to S1Translate struct fields Date: Mon, 17 Jul 2023 13:47:42 +0100 Message-Id: <20230717124746.759085-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230717124746.759085-1-peter.maydell@linaro.org> References: <20230717124746.759085-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.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, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689598623108100001 Content-Type: text/plain; charset="utf-8" Add comments to the in_* fields in the S1Translate struct that explain what they're doing. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20230710152130.3928330-2-peter.maydell@linaro.org --- target/arm/ptw.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 9aaff1546a6..21749375f97 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -19,10 +19,50 @@ #endif =20 typedef struct S1Translate { + /* + * in_mmu_idx : specifies which TTBR, TCR, etc to use for the walk. + * Together with in_space, specifies the architectural translation reg= ime. + */ ARMMMUIdx in_mmu_idx; + /* + * in_ptw_idx: specifies which mmuidx to use for the actual + * page table descriptor load operations. This will be one of the + * ARMMMUIdx_Stage2* or one of the ARMMMUIdx_Phys_* indexes. + * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit, + * this field is updated accordingly. + */ ARMMMUIdx in_ptw_idx; + /* + * in_space: the security space for this walk. This plus + * the in_mmu_idx specify the architectural translation regime. + * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit, + * this field is updated accordingly. + * + * Note that the security space for the in_ptw_idx may be different + * from that for the in_mmu_idx. We do not need to explicitly track + * the in_ptw_idx security space because: + * - if the in_ptw_idx is an ARMMMUIdx_Phys_* then the mmuidx + * itself specifies the security space + * - if the in_ptw_idx is an ARMMMUIdx_Stage2* then the security + * space used for ptw reads is the same as that of the security + * space of the stage 1 translation for all cases except where + * stage 1 is Secure; in that case the only possibilities for + * the ptw read are Secure and NonSecure, and the in_ptw_idx + * value being Stage2 vs Stage2_S distinguishes those. + */ ARMSecuritySpace in_space; + /* + * in_secure: whether the translation regime is a Secure one. + * This is always equal to arm_space_is_secure(in_space). + * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit, + * this field is updated accordingly. + */ bool in_secure; + /* + * in_debug: is this a QEMU debug access (gdbstub, etc)? Debug + * accesses will not update the guest page table access flags + * and will not change the state of the softmmu TLBs. + */ bool in_debug; /* * If this is stage 2 of a stage 1+2 page table walk, then this must --=20 2.34.1 From nobody Mon May 20 18:59:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689598641; cv=none; d=zohomail.com; s=zohoarc; b=AQaAMjHiV3zty3vwaUXrF317ctGSQTKFCpB5I86o3x/CF800pvIwmmVTeCVYj/ussVc2qbdxi+bO32GHFzyZhP+bPkwXi4JjRONB+bmU+C4hH/Jm5QWjtPh7G18oNyxM1xK7nayur8pSpgfz1vDtRIQWFPVm6fk6BVJzlhWFbwM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689598641; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6/kWyXsyxk23z+UX5RxhswptfdLynFYZwEMDMUpOvjE=; b=jirL2oiuZ+q4ZtcHBWIQCYDh2SaTtg3G8o3MriwjjE94zKnLoYxNwPA9DsqgKsmdVpYY5jKCKei2FmgDNZYfpWW6A0CfE2qRe8DlazfbroNUuVkm9EESMB97n80UUOsncJqdW2VnSFG/rymbjY4mfm4tNpp6atYXrI6jbCskVHE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689598641644739.9677975900205; Mon, 17 Jul 2023 05:57:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qLNhX-0002xG-I9; Mon, 17 Jul 2023 08:51:43 -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 1qLNds-0008TF-6P for qemu-devel@nongnu.org; Mon, 17 Jul 2023 08:47:59 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qLNdn-0008TM-82 for qemu-devel@nongnu.org; Mon, 17 Jul 2023 08:47:55 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fbf1b82d9cso40105105e9.2 for ; Mon, 17 Jul 2023 05:47:50 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v16-20020a5d6790000000b003112ab916cdsm19337737wru.73.2023.07.17.05.47.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 05:47:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689598070; x=1692190070; 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=6/kWyXsyxk23z+UX5RxhswptfdLynFYZwEMDMUpOvjE=; b=mxmdPB+Lwjmn3PTO103yjoXDjQgyeXU5CNsa/O6mOrPMRtn1b2EKu99lMq2aUzNb0i tJMDDY5NGujTQg/leKz3IzNPjPQsOxTncE+u1iWA3yVgLD4rh9uzxq18I+2gDuvlNTu1 UPmHmYpPDAGcvdZXvednZc08mLjJNSC/+i20m4wwYj9dvoud46ksnzrtYfL6+UkjyJTC ybY4zMDyrE1ikkXkMisI8ZHiznFasTh0FSXVMHcDCCEXZzfZBOfvwxFb5c8/ew9/3gPr Y0ULCFEKILGR/S59t7e5yiL4WC+B+oZni6DKjBxr9SuB8HBaInOVM6P7LRYmPN/nVxkm 8pOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689598070; x=1692190070; 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=6/kWyXsyxk23z+UX5RxhswptfdLynFYZwEMDMUpOvjE=; b=YqHdsiQKZoClMQUI86wHCzGMPBcZZp/rQd1brIQD5BTlzMHyPOzDYO9OISAwZU9A3F jshPkvvU1Ihvyvzwbug2IixgtXasU7A5dnknbLIuJ0IZixIPzUlNrLTS7e8FKMif1xM+ h3vhallntq/Jhp95ls4zANKOlSOYpvVP795c39Tm/xugfc0gQI6bqPICvISOKKKnz3Gt Vcskm2lFJVlEY1uWXE/caA3uJCGeJjfsJTXn84Kx1M+iiaHyvmof5Aqan2kWVOiPjnDR DouDns9yQo3Nypg7ZwiCj3PoEQiaDqeO/nT9yyAHsGEU7B4PoYhdEPohRtbZRKPU/q1c su3g== X-Gm-Message-State: ABy/qLbMhU+36fkhXN5RfKinoKNQMwSCHLjHhNq0RdeG7NFyJHKs2TMd y1R/wypqo8e064VfSIDkfFM645xrUFxe3E9Lvgo= X-Google-Smtp-Source: APBJJlHgNGnXc2GBuofx8vf3MJicP/0QnWdDKmv6BtiToCNF1vxNxnJfk4QVVyZi3KTYhwqAekoEOw== X-Received: by 2002:adf:f5cd:0:b0:30a:e9cb:1a2e with SMTP id k13-20020adff5cd000000b0030ae9cb1a2emr8531637wrp.65.1689598069695; Mon, 17 Jul 2023 05:47:49 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 4/7] target/arm: Fix S1_ptw_translate() debug path Date: Mon, 17 Jul 2023 13:47:43 +0100 Message-Id: <20230717124746.759085-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230717124746.759085-1-peter.maydell@linaro.org> References: <20230717124746.759085-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689598642248100005 Content-Type: text/plain; charset="utf-8" In commit fe4a5472ccd6 we rearranged the logic in S1_ptw_translate() so that the debug-access "call get_phys_addr_*" codepath is used both when S1 is doing ptw reads from stage 2 and when it is doing ptw reads from physical memory. However, we didn't update the calculation of s2ptw->in_space and s2ptw->in_secure to account for the "ptw reads from physical memory" case. This meant that debug accesses when in Secure state broke. Create a new function S2_security_space() which returns the correct security space to use for the ptw load, and use it to determine the correct .in_secure and .in_space fields for the stage 2 lookup for the ptw load. Reported-by: Jean-Philippe Brucker Signed-off-by: Peter Maydell Tested-by: Jean-Philippe Brucker Reviewed-by: Richard Henderson Message-id: 20230710152130.3928330-3-peter.maydell@linaro.org Fixes: fe4a5472ccd6 ("target/arm: Use get_phys_addr_with_struct in S1_ptw_t= ranslate") Signed-off-by: Peter Maydell --- target/arm/ptw.c | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 21749375f97..c0b9cee5843 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -485,11 +485,39 @@ static bool S2_attrs_are_device(uint64_t hcr, uint8_t= attrs) } } =20 +static ARMSecuritySpace S2_security_space(ARMSecuritySpace s1_space, + ARMMMUIdx s2_mmu_idx) +{ + /* + * Return the security space to use for stage 2 when doing + * the S1 page table descriptor load. + */ + if (regime_is_stage2(s2_mmu_idx)) { + /* + * The security space for ptw reads is almost always the same + * as that of the security space of the stage 1 translation. + * The only exception is when stage 1 is Secure; in that case + * the ptw read might be to the Secure or the NonSecure space + * (but never Realm or Root), and the s2_mmu_idx tells us which. + * Root translations are always single-stage. + */ + if (s1_space =3D=3D ARMSS_Secure) { + return arm_secure_to_space(s2_mmu_idx =3D=3D ARMMMUIdx_Stage2_= S); + } else { + assert(s2_mmu_idx !=3D ARMMMUIdx_Stage2_S); + assert(s1_space !=3D ARMSS_Root); + return s1_space; + } + } else { + /* ptw loads are from phys: the mmu idx itself says which space */ + return arm_phys_to_space(s2_mmu_idx); + } +} + /* Translate a S1 pagetable walk through S2 if needed. */ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw, hwaddr addr, ARMMMUFaultInfo *fi) { - ARMSecuritySpace space =3D ptw->in_space; bool is_secure =3D ptw->in_secure; ARMMMUIdx mmu_idx =3D ptw->in_mmu_idx; ARMMMUIdx s2_mmu_idx =3D ptw->in_ptw_idx; @@ -502,13 +530,12 @@ static bool S1_ptw_translate(CPUARMState *env, S1Tran= slate *ptw, * From gdbstub, do not use softmmu so that we don't modify the * state of the cpu at all, including softmmu tlb contents. */ + ARMSecuritySpace s2_space =3D S2_security_space(ptw->in_space, s2_= mmu_idx); S1Translate s2ptw =3D { .in_mmu_idx =3D s2_mmu_idx, .in_ptw_idx =3D ptw_idx_for_stage_2(env, s2_mmu_idx), - .in_secure =3D s2_mmu_idx =3D=3D ARMMMUIdx_Stage2_S, - .in_space =3D (s2_mmu_idx =3D=3D ARMMMUIdx_Stage2_S ? ARMSS_Se= cure - : space =3D=3D ARMSS_Realm ? ARMSS_Realm - : ARMSS_NonSecure), + .in_secure =3D arm_space_is_secure(s2_space), + .in_space =3D s2_space, .in_debug =3D true, }; GetPhysAddrResult s2 =3D { }; --=20 2.34.1 From nobody Mon May 20 18:59:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689598509; cv=none; d=zohomail.com; s=zohoarc; b=Sm36wsr7l1taWNuSB+nfMSE8PvwWAIDGyOD78ANgvBWcJANDsONj7zVj0pwdaN3g03Z4GWoIIzY4XNZQh/ZdSbAnMYdi2CPP5Pf198007wjeeknnkuxhz6B853l5Hug4r8QFcjbqHIvxVQOwb9m8stJaItpxkYXPe/lN5HOK/Yo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689598509; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uo7Bz898x5rT9AwvwOzRLp/mDtj2e+zf8fXMK+RWos4=; b=nmEG5YUpfTC6o0XXe/aTlUAZQxI03VVSTJslz2TXjlpi5FYxe+TWbDhLgO+bhAtlmN5bwzkK+CfdGglPZOJUUD+uQOGrUZdjjYjYnOMMpGPSp3nuPvnhCORN1ep+zIcyzoguoU55dsKWF8+pDGJeLqk0CBYoDDu9n8ll3EBs49A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689598509231247.76698147375134; Mon, 17 Jul 2023 05:55:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qLNhj-00031w-SJ; Mon, 17 Jul 2023 08:51:56 -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 1qLNdu-0008Tn-Ga for qemu-devel@nongnu.org; Mon, 17 Jul 2023 08:48:03 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qLNdn-0008TO-Tf for qemu-devel@nongnu.org; Mon, 17 Jul 2023 08:47:58 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-3141c3a7547so4228516f8f.2 for ; Mon, 17 Jul 2023 05:47:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v16-20020a5d6790000000b003112ab916cdsm19337737wru.73.2023.07.17.05.47.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 05:47:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689598070; x=1692190070; 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=uo7Bz898x5rT9AwvwOzRLp/mDtj2e+zf8fXMK+RWos4=; b=GYUsfFKR9xT2o6l43WZ+dZODQn7mm/uHx8nxfV0ktVv2Aw76+qDzPhPUAOa8M8+x3q pvGOGWHzU3y3EBghgd3O+Qk1vw4JPuxvnis3mF0LLunw4PzaXaD+QboYvYG6QLHSyz+N D/DB7yXf4PQvnVbIjCydFzdL5hi6045zux4I19i1z8n+gVMPx/YmkH1waOar/PMZriHp 531ec87mzNIcTuuUviLokzrTgsH0HArybNwr/tfSQ3oMwUTNrXjcTrMnGe9tgODLelcl n3VRvPjzK0e32bBjzHf2H48LRQAWVOzGQYwPpKjJ6/k3O8ex9zy3pFiprfb2NfxQrTZH bgoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689598070; x=1692190070; 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=uo7Bz898x5rT9AwvwOzRLp/mDtj2e+zf8fXMK+RWos4=; b=W43XiSl8CEm/qQbzhtbPidhqeUMzlujUfwKs7O+WmVD6wtKozfpL50LD7+fn279A0r KuN9NEz6g6Ov1YeYYG2yXKQabt+jxXZ8CpUJUwyPlN2VKK8/6Z1EEv/latVlHgcK9gwh cOPc/e/z1ozmEodI8vmkrcH6LfKjNWp8oUlkdgNXzYH3QbncWGuvVaO7AlaBntQF8c9z /SxQUyxDmFOewMfwov9NuDzBV/4rICq240BW/1LAHG0zSFDanBBTB7zs6SVbePz6nVph zw15TCYWFIte/16bJ58DpmuR0AfJ1gfBjt7Tyd/FSfMPmhIc0Ib3hYwa3HHsMHAuuajp TNVg== X-Gm-Message-State: ABy/qLYC7AzPRrpos0zPSc20FBZcyCDFAlRf6gN5VDqWvLXPVlW4bIEX S6R/vh0FVimaZvYcvZcIGif6TEcFDXdyo+1EM/A= X-Google-Smtp-Source: APBJJlFbeKs33+ZHyvIZSW1ie8luuQoBNXAM1/RvegoEDH6Pdi686wLzUMkF8ulJVnjz6cJI2e202g== X-Received: by 2002:a5d:4c41:0:b0:316:d887:624a with SMTP id n1-20020a5d4c41000000b00316d887624amr9872600wrt.15.1689598070052; Mon, 17 Jul 2023 05:47:50 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 5/7] target/arm/ptw.c: Account for FEAT_RME when applying {N}SW, SA bits Date: Mon, 17 Jul 2023 13:47:44 +0100 Message-Id: <20230717124746.759085-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230717124746.759085-1-peter.maydell@linaro.org> References: <20230717124746.759085-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689598509811100001 Content-Type: text/plain; charset="utf-8" In get_phys_addr_twostage() the code that applies the effects of VSTCR.{SA,SW} and VTCR.{NSA,NSW} only updates result->f.attrs.secure. Now we also have f.attrs.space for FEAT_RME, we need to keep the two in sync. These bits only have an effect for Secure space translations, not for Root, so use the input in_space field to determine whether to apply them rather than the input is_secure. This doesn't actually make a difference because Root translations are never two-stage, but it's a little clearer. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20230710152130.3928330-4-peter.maydell@linaro.org --- target/arm/ptw.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index c0b9cee5843..8f94100c61f 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -3118,6 +3118,7 @@ static bool get_phys_addr_twostage(CPUARMState *env, = S1Translate *ptw, hwaddr ipa; int s1_prot, s1_lgpgsz; bool is_secure =3D ptw->in_secure; + ARMSecuritySpace in_space =3D ptw->in_space; bool ret, ipa_secure; ARMCacheAttrs cacheattrs1; ARMSecuritySpace ipa_space; @@ -3200,11 +3201,13 @@ static bool get_phys_addr_twostage(CPUARMState *env= , S1Translate *ptw, * Check if IPA translates to secure or non-secure PA space. * Note that VSTCR overrides VTCR and {N}SW overrides {N}SA. */ - result->f.attrs.secure =3D - (is_secure - && !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW)) - && (ipa_secure - || !(env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW)))); + if (in_space =3D=3D ARMSS_Secure) { + result->f.attrs.secure =3D + !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW)) + && (ipa_secure + || !(env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW))); + result->f.attrs.space =3D arm_secure_to_space(result->f.attrs.secu= re); + } =20 return false; } --=20 2.34.1 From nobody Mon May 20 18:59:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689598369; cv=none; d=zohomail.com; s=zohoarc; b=Wj9r1+IRtdMN+NeDRtsw9C8k/1FeFOy85Q280kMgPy0Rf4LnkTmtRsrJG2FgTiiVmtKLSukxpT/i1FOyNDo4/JgHIsjk+euukENouFwCn5kZNimroPpoMqDhXxF0l/rowkEp7Qa8VwuW3jLS1wGy9938c7lY1MF6ayKYLIDPtXs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689598369; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=edbJjO1yTMsccjp+1Oi4Tpx97oGTrv0Dg957zzrUT/c=; b=jXDILUMq4KGZwIXbCXzFR+3vseiFA73pd9zkj+WS1Eubi8kpYIC7zAinHzYqZWItdAT7rbuRpxlV7lJwdm69qH17ZGJfLBZNamWUInyybfRz03v6u3JjujZwXq/8ecXbV0DTOiOQPLAJpjXSKftS2tg3PX9EYqkm6vynZhycStQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689598369432256.72707091401514; Mon, 17 Jul 2023 05:52:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qLNhC-0002Z3-KM; Mon, 17 Jul 2023 08:51:25 -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 1qLNdu-0008Ti-9X for qemu-devel@nongnu.org; Mon, 17 Jul 2023 08:48:03 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qLNdp-0008TT-6c for qemu-devel@nongnu.org; Mon, 17 Jul 2023 08:47:57 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-316f589549cso1815919f8f.1 for ; Mon, 17 Jul 2023 05:47:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v16-20020a5d6790000000b003112ab916cdsm19337737wru.73.2023.07.17.05.47.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 05:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689598070; x=1692190070; 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=edbJjO1yTMsccjp+1Oi4Tpx97oGTrv0Dg957zzrUT/c=; b=P0wB2kGqlRahKS5nj+YO0xzESU/X7CEd+dj4vYEVMdHuFBD1JUKoqYxzczfFOuxx1B SHOBTYGRUW0YfyLuBXEOVprOH5UjiAqiMn377pNhQ/pu65bXIrxlt39Z0GZ11Biyn8a8 oYa43mag87FReeVPeseWbVmFGbjb9hH88DzvUPOdubwQAgyaiau6pD+rxUCBaxKIOkTT 4R8pWMzkF5FPXeIJ5cBlRdKb/Ig/4s9YEZgIRTUyk+UXaKzQ0vvnwKqffBsZSvtrufsO qKoMIxnM/2/5Yqz14nzwru/syR1K5gZwgN6+A9TCtxysmNRryxhymLAWsng5qFFr3UgL uMow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689598070; x=1692190070; 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=edbJjO1yTMsccjp+1Oi4Tpx97oGTrv0Dg957zzrUT/c=; b=hY4aqKlRsV+FV4oh1IJVYH3Aj+1qgIkTFz0nKQPGd685Dx4+lggv/u0MGBjFl1gliq U2LQ6NniYkKvj7m3vva0AbhUk0OGH4u5Y0I7rK7DvhH2rb8Z1DJuuyePbJEOWk0nCKt9 8tIGqLbWdI4UsCu7EtSSgfgLXqUiW3ZaIGUQW8Eeh93MmXDT8UJkERut6L+kdPO9+neq V33jaFqyKfcyy/bI3q1mjhCDkhwxWrhxcX3e7c4ZVNKew86rcG6rIFY1U27R8Px5ZgIP qt1/cAccTJ5l7vlIfhtJIt7RQvqSs0Z3/Tx2eVnJmV8W9l2f3/f1+Zyd+b4B9FxukwDq oNvg== X-Gm-Message-State: ABy/qLaR7g4s66VnxSyznDqZjkh2eBQgITCj+6jRL3se6GotvKVGHASb i5xsqgBMDvTFjSupjiNl37IefSfpS1r5Bm8Gci8= X-Google-Smtp-Source: APBJJlHiOyi3ts1gBI8CYYSAHCCfkPvmswl3HQRZDea0dfkH/TVD7faKsiPX7DYaryKTnDQ6YaKraw== X-Received: by 2002:a5d:4e46:0:b0:313:e8bf:a77 with SMTP id r6-20020a5d4e46000000b00313e8bf0a77mr9476225wrt.5.1689598070470; Mon, 17 Jul 2023 05:47:50 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 6/7] accel/tcg: Zero-pad PC in TCG CPU exec trace lines Date: Mon, 17 Jul 2023 13:47:45 +0100 Message-Id: <20230717124746.759085-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230717124746.759085-1-peter.maydell@linaro.org> References: <20230717124746.759085-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689598371359100005 In commit f0a08b0913befbd we changed the type of the PC from target_ulong to vaddr. In doing so we inadvertently dropped the zero-padding on the PC in trace lines (the second item inside the [] in these lines). They used to look like this on AArch64, for instance: Trace 0: 0x7f2260000100 [00000000/0000000040000000/00000061/ff200000] and now they look like this: Trace 0: 0x7f4f50000100 [00000000/40000000/00000061/ff200000] and if the PC happens to be somewhere low like 0x5000 then the field is shown as /5000/. This is because TARGET_FMT_lx is a "%08x" or "%016x" specifier, depending on TARGET_LONG_SIZE, whereas VADDR_PRIx is just PRIx64 with no width specifier. Restore the zero-padding by adding an 016 width specifier to this tracing and a couple of others that were similarly recently changed to use VADDR_PRIx without a width specifier. We can't unfortunately restore the "32-bit guests are padded to 8 hex digits and 64-bit guests to 16 hex digits" behaviour so easily. Fixes: f0a08b0913befbd ("accel/tcg/cpu-exec.c: Widen pc to vaddr") Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Anton Johansson Message-id: 20230711165434.4123674-1-peter.maydell@linaro.org --- accel/tcg/cpu-exec.c | 4 ++-- accel/tcg/translate-all.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index fdd6d3e0e44..e2c494e75ef 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -298,7 +298,7 @@ static void log_cpu_exec(vaddr pc, CPUState *cpu, if (qemu_log_in_addr_range(pc)) { qemu_log_mask(CPU_LOG_EXEC, "Trace %d: %p [%08" PRIx64 - "/%" VADDR_PRIx "/%08x/%08x] %s\n", + "/%016" VADDR_PRIx "/%08x/%08x] %s\n", cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc, tb->flags, tb->cflags, lookup_symbol(pc)); =20 @@ -487,7 +487,7 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *= tb_exit) if (qemu_loglevel_mask(CPU_LOG_EXEC)) { vaddr pc =3D log_pc(cpu, last_tb); if (qemu_log_in_addr_range(pc)) { - qemu_log("Stopped execution of TB chain before %p [%" + qemu_log("Stopped execution of TB chain before %p [%016" VADDR_PRIx "] %s\n", last_tb->tc.ptr, pc, lookup_symbol(pc)); } diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 4c17474fa22..a1782db5dd7 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -637,7 +637,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) if (qemu_loglevel_mask(CPU_LOG_EXEC)) { vaddr pc =3D log_pc(cpu, tb); if (qemu_log_in_addr_range(pc)) { - qemu_log("cpu_io_recompile: rewound execution of TB to %" + qemu_log("cpu_io_recompile: rewound execution of TB to %016" VADDR_PRIx "\n", pc); } } --=20 2.34.1 From nobody Mon May 20 18:59:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689598593; cv=none; d=zohomail.com; s=zohoarc; b=aAg/zaA7Go9G6DZ9+tL18rIX2U3NKLGlE7nLSnkKKGL8NWBKKbcUFjXAlspp8ushNRwqPdUI+puhyB80UhFa3AaTRovEIBlnhXIsjMh7wxcOafXWVzJGdHqPl5FMKVcE56ZUopO3xDcl5CTkVgxE4YGh1W1N4uiRNlufAYxWnZ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689598593; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fm7KSG5NrB8kIIZoFYKUbYE9OkMwBur5haFqwy0lLuU=; b=ICD14W89A+8DveqrMD+6fHoQDo/siBBczDRJpufzGyHRbHYl2Re2UV7TsMyeb/YqnQebXa95KiFGoWdchDOPWAUDg0kBX/x7da7vOGSbF6t3p3BO3ON2xQ3xwFxP4H/I7X6b6jwV189nouzaQp7TYdMC5eSFE/tTqpwXqvyRSNM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689598593949492.95818372561484; Mon, 17 Jul 2023 05:56:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qLNgp-0002Wx-9o; Mon, 17 Jul 2023 08:50:59 -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 1qLNdu-0008Th-94 for qemu-devel@nongnu.org; Mon, 17 Jul 2023 08:48:03 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qLNdp-0008TZ-Nh for qemu-devel@nongnu.org; Mon, 17 Jul 2023 08:47:57 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-31590e4e27aso4023989f8f.1 for ; Mon, 17 Jul 2023 05:47:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v16-20020a5d6790000000b003112ab916cdsm19337737wru.73.2023.07.17.05.47.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 05:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689598071; x=1692190071; 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=fm7KSG5NrB8kIIZoFYKUbYE9OkMwBur5haFqwy0lLuU=; b=LBJBrnKHnBJ7Jkw/hZ3RoZkFVs/VVlV7w4myj8JMR/OTdeBvq0DGXU5/EPp41o3moW w/nYN3onsfgiCWPhIJ018C5usmnrjOf1O25YZMl1nyFp7Ug1wLxLm2V3i3geehqmIxt1 3xmjFWZgq5pmXjK+xH/dh0XcWNgU3KEMSvdpchZFMm1TXBUD+/XgRbV9P0Nk194K9us6 Uh97KEkYdQM3ujjIj8bMAzsfwADv7Z/vtJ5BvQjFyhY77ND5U4RtYjyRjbSK3g9MABM3 mFp4XWU0nHCYKLqNaMByINTbMkH9+bG4kn1iMLO2f53uZzfMaLlRkqxxiJDlTdDqhvRM HrnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689598071; x=1692190071; 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=fm7KSG5NrB8kIIZoFYKUbYE9OkMwBur5haFqwy0lLuU=; b=GLGWefEueG6SVPtl+vHQHZCeFlmN6OZb7Ev4O+jqMKFbdkJvQ3J2ITouueDhBpzfpF WyzYo3HbBQSEp6ct2cergfZHMT0ylwqCT0u+1wCyiSQ6An6XvLJ/UiRX7RQuyCxkjgPr xV5xJ4I9S6eUc2cHMC8r7ioIm+K+kam4aw0B2+1X5y6DxL3Y2/+rLt8bbVKV/EiY2OFT uvqEVMFNqSOAtZJyaVNKAIxtuuoGDgnT7LT3CocFmMB5tj2JQxPcz4ttNVwDasgbMZ1y 4eBJjZGZYc23aenQ89PKw4lhFfEanlCpAQrOzDjxp0qx3iTKGtHYJkdMVVOHQoL2p1WY 96ig== X-Gm-Message-State: ABy/qLbb8Uxis9d1hXkVH/c2P356pl9n4U1xKbgrJtfpCEDUdYmJ2IVe Z2BKKngSJtFUS3TVxgZMYCajDXQ5f+OFOGVl8po= X-Google-Smtp-Source: APBJJlH0bVXCfop2RRBQYpyP9vhuUzMzvgePOOOv0zaS1utNMtdtHAlneFeWQ8c5K5/cYnlHI2LWAQ== X-Received: by 2002:adf:d4c4:0:b0:313:e953:65d0 with SMTP id w4-20020adfd4c4000000b00313e95365d0mr9147896wrk.28.1689598070913; Mon, 17 Jul 2023 05:47:50 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 7/7] hw/nvram: Avoid unnecessary Xilinx eFuse backstore write Date: Mon, 17 Jul 2023 13:47:46 +0100 Message-Id: <20230717124746.759085-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230717124746.759085-1-peter.maydell@linaro.org> References: <20230717124746.759085-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689598595980100003 From: Tong Ho Add a check in the bit-set operation to write the backstore only if the affected bit is 0 before. With this in place, there will be no need for callers to do the checking in order to avoid unnecessary writes. Signed-off-by: Tong Ho Reviewed-by: Alistair Francis Reviewed-by: Francisco Iglesias Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Peter Maydell --- hw/nvram/xlnx-efuse.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/nvram/xlnx-efuse.c b/hw/nvram/xlnx-efuse.c index fdfffaab99c..655c40b8d1e 100644 --- a/hw/nvram/xlnx-efuse.c +++ b/hw/nvram/xlnx-efuse.c @@ -143,6 +143,8 @@ static bool efuse_ro_bits_find(XlnxEFuse *s, uint32_t k) =20 bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit) { + uint32_t set, *row; + if (efuse_ro_bits_find(s, bit)) { g_autofree char *path =3D object_get_canonical_path(OBJECT(s)); =20 @@ -152,8 +154,13 @@ bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit) return false; } =20 - s->fuse32[bit / 32] |=3D 1 << (bit % 32); - efuse_bdrv_sync(s, bit); + /* Avoid back-end write unless there is a real update */ + row =3D &s->fuse32[bit / 32]; + set =3D 1 << (bit % 32); + if (!(set & *row)) { + *row |=3D set; + efuse_bdrv_sync(s, bit); + } return true; } =20 --=20 2.34.1