From patchwork Fri Apr 7 18:51:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 671028 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp470476wrt; Fri, 7 Apr 2023 11:53:15 -0700 (PDT) X-Google-Smtp-Source: AKy350YW/Ixn4Hv8cS6pO5BIt8gboB0EMjpYJSDfMSeMhmzSeR21P9ZOTrbB32E5alrL4W4ldMVz X-Received: by 2002:a05:6214:1c49:b0:56b:f1e3:320 with SMTP id if9-20020a0562141c4900b0056bf1e30320mr4749469qvb.0.1680893595493; Fri, 07 Apr 2023 11:53:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680893595; cv=none; d=google.com; s=arc-20160816; b=Vd3QCIXhzf5RctACaaskPFXPFXq+eiZ8r50okzOfxzAvt2WROF4Kob2X9F2fZcFlqb Ad6JlHctRlyxaV1LjnTzUVUA4YOk8yK3xvcb/wxohBMY3doUAlOYvMEadxIHD44Mk45K 0uvqgYufkL7sFJSclN73nPzfoaPnw59+ITk810SfN4rVRSR75ZOtvyNUIUg8RwOs5NfE y2ESHeRN0Yn5VmT3GBoHVt+jV62Y1QWlhr2zwzNBmHqjCPutCcx9++jJmdED4lXJ+osz HdREpAVMl4nALwZWKfRNl2QB+/iZ1g3Dzuf7dOfibYDdQeaMgBF9PyhVLa6N0sbcnzZR TGjA== 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:cc:to :from:dkim-signature; bh=2qWjpSR7JS8/58Ywm9SNFYWb7gykfyATwi7wvhb4xc8=; b=VZaQdUOCeEAoFwHhTGGq3PBeTi+KHMc+I1iDHy1oyVTkpJ6UUyriAR8/x8vV6YXEfW 4JAe7oK30i8TGlAZrm1ajDaNSu6D5C5YTzbvMmVrG2Pi7ige6vkL9wBkjsTOQPHZVqiZ C4JO9WUcWzXzY7FYDuLfFk2T/4zbh7wYWyvvhxULRm/jqn3g5KKjQAzNdCDO3aQyOGaE wQsamtqZjPWmTRqV6l0NhRg6w9ddG3HJ0iEvm/4jE0qTXYYK5Jw43DwmYHED9z++HKpb ndch0JC11iKL1OAG6yHoegG8DerleJKIIXS+iTYbxI1Cdebt57+xGUMWk+AdvUJ5xmPU C8xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d7QEVjRj; 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 gv4-20020a056214262400b00584339a79fdsi3255716qvb.375.2023.04.07.11.53.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Apr 2023 11:53:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d7QEVjRj; 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 1pkrBn-00053E-5z; Fri, 07 Apr 2023 14:51: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 1pkrBk-00052B-FU for qemu-devel@nongnu.org; Fri, 07 Apr 2023 14:51:56 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pkrBh-000874-Fn for qemu-devel@nongnu.org; Fri, 07 Apr 2023 14:51:56 -0400 Received: by mail-pj1-x1035.google.com with SMTP id 60-20020a17090a09c200b0023fcc8ce113so2031827pjo.4 for ; Fri, 07 Apr 2023 11:51:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680893511; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2qWjpSR7JS8/58Ywm9SNFYWb7gykfyATwi7wvhb4xc8=; b=d7QEVjRj8bLrUGAByzh3iK60WtnSRXb9Ei1/8vlsQ8rDTAg6gZWxiKGsqjBUtAZlqN dpEc2UVgl0qHQHF0uzUrONXWKFXsB2JhR4OKSy8X7us3pavVh660IYVoZzfcv6N66NVj GzfGp+BxAjNu4zCt1ZMOuQSLu+Myd31W1Sk4DeSE2vswuhWPBj5zzx5gVV6zyYmUVY0C ihUES38khSFyREVm20wMhRudEHbezQ7vF+jUeaVPpBukiK0rhZ1sknxeIMao4fiZDlEl DZjNNhm+jwCPyL7MoEfoZwJgqi/ymDDVQAl7mQPWJQS1hmDS7bdEa1HGNhK07WS29AlZ N9Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680893511; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2qWjpSR7JS8/58Ywm9SNFYWb7gykfyATwi7wvhb4xc8=; b=2UhhzB0/yD70gWSCiSl4MKcT+vsQGbnXCl20Z+lA2l/szG0zUnibvk9BI1fD4nS8YO thUShCzlZ9y3eHl57LbgVMBOjaFJby4ptrRSeEoiNoCQgIl/GPao/WJc0d6ek5L8vABy u+BfWvBphY91v/04X12LpBRS2jSOxd8NQCA/0+bj6VK+ljQ/kmKE/WSChSNknjywq6kc 9p46RkiAaBRqvUroXIFU5PRH7V+I0XyPjGWuQnJnsoA2f85jw//6viCncQDBAHGrIm2/ TjjDjavkvb4ttlb0JU8QE6vJsdEM7gdy4mxuudpFrimh/BjGoWOPU0ZKPk6RoHG1P/OI 8y/w== X-Gm-Message-State: AAQBX9fOAiBR7tzNbXWC2yi9EjN/bLDjNthJPeKt+cpEhHAlc3G+zR+a kxuhXF/P/y5Rz8GcJ65NAECNq9fiJHgL0LZpHl0= X-Received: by 2002:a17:902:cec7:b0:1a1:c82d:dcf3 with SMTP id d7-20020a170902cec700b001a1c82ddcf3mr12068847plg.12.1680893511072; Fri, 07 Apr 2023 11:51:51 -0700 (PDT) Received: from stoup.. ([2602:ae:1541:f901:8bb4:5a9d:7ab7:b4b8]) by smtp.gmail.com with ESMTPSA id v4-20020a1709028d8400b0019c13d032d8sm3205796plo.253.2023.04.07.11.51.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Apr 2023 11:51:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH 1/2] target/arm: PTE bit GP only applies to stage1 Date: Fri, 7 Apr 2023 11:51:48 -0700 Message-Id: <20230407185149.3253946-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230407185149.3253946-1-richard.henderson@linaro.org> References: <20230407185149.3253946-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Only perform the extract of GP during the stage1 walk. Reported-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/ptw.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index ec3f51782a..58a6de09bc 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -1585,11 +1585,6 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw, result->f.attrs.secure = false; } - /* When in aarch64 mode, and BTI is enabled, remember GP in the TLB. */ - if (aarch64 && cpu_isar_feature(aa64_bti, cpu)) { - result->f.guarded = extract64(attrs, 50, 1); /* GP */ - } - if (regime_is_stage2(mmu_idx)) { result->cacheattrs.is_s2_format = true; result->cacheattrs.attrs = extract32(attrs, 2, 4); @@ -1600,6 +1595,11 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw, assert(attrindx <= 7); result->cacheattrs.is_s2_format = false; result->cacheattrs.attrs = extract64(mair, attrindx * 8, 8); + + /* When in aarch64 mode, and BTI is enabled, remember GP in the TLB. */ + if (aarch64 && cpu_isar_feature(aa64_bti, cpu)) { + result->f.guarded = extract64(attrs, 50, 1); /* GP */ + } } /* From patchwork Fri Apr 7 18:51:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 671026 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp470475wrt; Fri, 7 Apr 2023 11:53:15 -0700 (PDT) X-Google-Smtp-Source: AKy350ZNFqqMkPhIRmir9zrRzpRQLpr/jy5eX1N4tNvMl2nxj9NdUdIWxM36MJ4pl54T1gC6/d5q X-Received: by 2002:a05:6214:29c5:b0:5c9:a0ce:df0c with SMTP id gh5-20020a05621429c500b005c9a0cedf0cmr165459qvb.22.1680893595432; Fri, 07 Apr 2023 11:53:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680893595; cv=none; d=google.com; s=arc-20160816; b=UX/oLfPqVo/jvfHYUpTROIDgtfu8rKrBCK9nBGnhf/RMMKUGAEFuDJMoTAGHM92R8X VqPXgCZCuR1jQVrW7LCW0SyPPp13P6z2PyU9xd2G/BHjEE/zK2x0+O9i2Ls0t2XHZUeA AmE/2lK9ltKxRZek3m5kY5EPok0711LBg8N3yrHCUDdk/F2Rq5O+guWVlvKz9J6TgkkD O5rgcHPb0mYAAGOmUg9FibMKsJCulRMd447AVkemoJdQu48Y5gFjbNTdXUyJClXHR1vc u+SVvGemTHm6nA3d/QUrQhADV5IYLh+vnoEPiAdloKfC5FLUYbMQ4ofZDYAdLvXhVhdx Gi/A== 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:cc:to :from:dkim-signature; bh=zTH6CuxWrs3z8O8UOxqSLGt5vbpCwQ7b4HezyRm7T4A=; b=xQJkdVEC+1iich0JgwXH7Y05xs6FPvotQKktqHpeZG6Ptxe2cqic2hQ4Bnq6OSj4Oh MCVMJA/lnhEdMGjOwNLDaFrVBzFrwghMxt6wqitau+V4th/tpMRC7ueC347zxj8jTHsh luZSjEKRZ2AtlIjusfX2k9h+6HHrvj/Sd2LjfWC9ugy7Pn0yxUaEfJ2H2ovWr8jGssFn VHBXiJyDdOfQi0JUcdh5QOlylVBAQhF99rLzmWuZ3762TjAG/iKlKoNWm96VWYVSd1iX 5Z2mjpC6199KO7Rod0JK7ur7UyCjS6gQzk16rE3Fluh5bE5ExQTdEM1384geq3Sd8ZMF 19Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ITvzG9Z+; 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 d12-20020a05621421cc00b005e7b68e9a45si2076915qvh.165.2023.04.07.11.53.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Apr 2023 11:53:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ITvzG9Z+; 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 1pkrBn-00053L-9j; Fri, 07 Apr 2023 14:51: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 1pkrBk-00052K-MY for qemu-devel@nongnu.org; Fri, 07 Apr 2023 14:51:57 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pkrBh-00087V-GV for qemu-devel@nongnu.org; Fri, 07 Apr 2023 14:51:56 -0400 Received: by mail-pj1-x1035.google.com with SMTP id go23so2421044pjb.4 for ; Fri, 07 Apr 2023 11:51:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680893512; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zTH6CuxWrs3z8O8UOxqSLGt5vbpCwQ7b4HezyRm7T4A=; b=ITvzG9Z+LfxLtCWv+7OYOSLDXxlkY8q+kL4+VK9C+PMjZOajRxHU4m69Y/93/zgTup 826AdLSBxO0ooW5RbEJipPGx+st8cOZEHSRuaWJirNUxt5yDWS279QDUvou1WwQsIQaC 3fOg6ijoh06WxWF3BA2ohVHCPa1uiGhYEbSFKMlXcoqOzHaybMjQvtfHPSF673l2QUeY F8ZKrPG+GfbXvJfs+qCNtacBI/NRgPZogRzHv9rQq3Q9wekgeQoSrCny6GRA+RY033Ox CLyzS0IxHtaMwNL/nyKPnYCth8fzoJY15Atm0eZM/FUj53PdKqpyFIwmuveQeg59CdSx Gl9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680893512; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zTH6CuxWrs3z8O8UOxqSLGt5vbpCwQ7b4HezyRm7T4A=; b=6r4ME0zVwR3ggXBJBSyguiTKKAISRV4xTCaMY4UQP/9xQsYDjELEEO7kd1KPRQgU32 +IT6ls3347w0IanTed7Y/Ui+b25dwnsjrXj9H7xQmQGN8TFP5r6WucvF6MQFki/6L2gr 9Ui5GtpBUXqEmfZHqapAU4jWr46pxgVMuB4WCj+PVRi6Hl4afFAgMZ9cg3e3wknE3nu4 zzsNhj3Al3EQgWmAc7uENgcB/WuiUhcTsXwgMptAfUQ2VOmCpKBhiVGc3yOTgAPuWP8h Ji1Bk99BbDDzL8Ujfxtxzb8u4WtnIibg4lAgXvfoZ13i6EWG9OYRiqzu4P6Dgk/Y3Wq4 ehMQ== X-Gm-Message-State: AAQBX9ene9KA/JNAUBDEsO+KU7RgTvQ0P6F988+g+F+kUKBnV+c8l/AE 1ZN4MJ0it6B3h/8geqK5iVAd8gWGMceu0wh5xfU= X-Received: by 2002:a17:90b:1802:b0:23f:9d83:ad76 with SMTP id lw2-20020a17090b180200b0023f9d83ad76mr3342835pjb.23.1680893511990; Fri, 07 Apr 2023 11:51:51 -0700 (PDT) Received: from stoup.. ([2602:ae:1541:f901:8bb4:5a9d:7ab7:b4b8]) by smtp.gmail.com with ESMTPSA id v4-20020a1709028d8400b0019c13d032d8sm3205796plo.253.2023.04.07.11.51.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Apr 2023 11:51:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 2/2] target/arm: Copy guarded bit in combine_cacheattrs Date: Fri, 7 Apr 2023 11:51:49 -0700 Message-Id: <20230407185149.3253946-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230407185149.3253946-1-richard.henderson@linaro.org> References: <20230407185149.3253946-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The guarded bit comes from the stage1 walk. Fixes: Coverity CID 1507929 Signed-off-by: Richard Henderson --- target/arm/ptw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 58a6de09bc..6d72950a79 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -2576,6 +2576,7 @@ static ARMCacheAttrs combine_cacheattrs(uint64_t hcr, assert(!s1.is_s2_format); ret.is_s2_format = false; + ret.guarded = s1.guarded; if (s1.attrs == 0xf0) { tagged = true;