From patchwork Mon Nov 14 15:52:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 624824 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2699822pvb; Mon, 14 Nov 2022 17:21:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf6+WjlFyAAeo0L/XBDIH4+4d/qAonbQs6BRKbdQODcP8L4mQMKtwYAfL1r8u6c6LTvkqpq3 X-Received: by 2002:ae9:e106:0:b0:6e2:5472:345e with SMTP id g6-20020ae9e106000000b006e25472345emr13719125qkm.391.1668475284140; Mon, 14 Nov 2022 17:21:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668475284; cv=none; d=google.com; s=arc-20160816; b=Iuyg1VHCi01yRWQd3pD5qQCQOLBF7GZoMRz3f0c+TKmdip9AjGQ8A1Gk1m9+Md4U8/ AQctq1zNOfJWf9Fn4LX7Fa+zysG/Bmc9jgCgy3PJVZpthqay5BSmyriO/8zf908bZA2o +uzswBAkDI6Rps1envv1woMZ8mvEbvzYU3Ms23TqhEBjE64uoC9l3eovVNuYPGB5LBrl sHInHlvvTUCFUxH1qTVnPBhOi6HTJ6TgF5fFH2hnMBxERFkJPVxMX/iy/hxb2b9+TsUU VG7XLUnGEV7n7+BgPQEggmw4d+d4sNyPCqK1xssxMQ2Wv8RHy0WTO0egiOdJBJ7FDAE1 nrzQ== 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=5gAoRJ9snJqPL2rFJvOBSQyfEm9L6rPkUPHA5i8B/Ug=; b=K1Szq9lDgyHzv2QTZU7QBLoiPc4OQG56IICw8u7eiw9qScMpniy20wo+10HF8qUtr5 8jgva+EL9sPYboKeKuOCVCam2YMwAWzsQeghiYs91bDVf7n6EOLcCaRzgZ0/pToma4ZO JielRT4g/JIomrGeSMfzXkCw0Xoy0doRv+OYTGrYtZYinKii0Qt+VPsXpH9gxhNAF7zi nXfQYIDcLcOPMxmmTOl+IZ31sO5WaFpTXWaZUUK+XeDDy9iyIjYopT7ZDSRUO2PVqUue frHrN7p8IuPEL7JU4IKW1up6rMi8crO7nsDuKDcKCtZWKzfXS37tEx53vb8fwxLommwr JU/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WwL3kcua; 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 ck12-20020a05622a230c00b0039ce03bea3esi6810955qtb.573.2022.11.14.17.21.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Nov 2022 17:21:24 -0800 (PST) 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=WwL3kcua; 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 1ouik8-0004x5-2o; Mon, 14 Nov 2022 18:19:56 -0500 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 1ouif2-00049x-9i for qemu-devel@nongnu.org; Mon, 14 Nov 2022 18:14:42 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oubkm-0007Ht-Di for qemu-devel@nongnu.org; Mon, 14 Nov 2022 10:52:10 -0500 Received: by mail-wr1-x42e.google.com with SMTP id o4so18939910wrq.6 for ; Mon, 14 Nov 2022 07:52:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=5gAoRJ9snJqPL2rFJvOBSQyfEm9L6rPkUPHA5i8B/Ug=; b=WwL3kcuaij1Ydn7R4NXPASMMXpMStD4Aid/N+ZbV4JNQ99q0HLCSc2DROyM0I55opE lBI+zjEJp8naZ09spKGz14NJOh2sRtqBkZjNGKOmTuXb0Dxtv+KrY/HlwzAmHCuaUdDd H5dVs+t1YPizlQl4lXHrhobeXOuRXFXS7DFbIVDjHoZNbAdSeKHkjMe2yUce0QypNHWh LhbCY962mtlP0T5RL2yk2fzJ/cQACruNGfloW5cRg/U0OAAevflsZBwGIwmPK9Hh410h jun9tC9kYqFuPNmg1Gnb+00tEx3uIjSJhZULueNfutktVdQwb5N1lzV+PYwp3N5I06zZ RVhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=5gAoRJ9snJqPL2rFJvOBSQyfEm9L6rPkUPHA5i8B/Ug=; b=dmqQ6D0MA2T9r/Aq01+x6AX4BoxTCpqsORZDi/e5vkSGmPjG7sCdXcSxOh0ym3L90/ yQ49gCstqmM6jXXHrk3+lmv+dmUPDSpqxg2yxlNr0mQqOPzo/yc6TuJ8+xUodv7d/VNj 8LxcSiqnoDCiaTUnW6KIhBSrkkOjapYQK/p4awEZqKjeVJ1eEjVRoxd1hgnJKzDUc8Kz VxZbmZ4Ay9mQ3+YMp5BYOpxzq/BKfWfgyHUoSA7rnjWc1CdnWcP6y/kaVwO27u9Crh2r Yy8Aoqu9geigq/WiiAZdGKnPEePDcqrPrloIel2As/XX+jEntuKrLmPMz2Pq446LsaIU rEag== X-Gm-Message-State: ANoB5pn/+1v6qDejtn3gmkxwlviHYBDCOeAP6lWsFTwf2wo5vhFoMGdm D9Zct1GWSI3WGcAvVuQAknE4qIXrcgqSgA== X-Received: by 2002:adf:e852:0:b0:236:8d39:6f84 with SMTP id d18-20020adfe852000000b002368d396f84mr7549203wrn.152.1668441127088; Mon, 14 Nov 2022 07:52:07 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id m66-20020a1c2645000000b003cfd58409desm9039277wmm.13.2022.11.14.07.52.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Nov 2022 07:52:06 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi Subject: [PULL 2/2] hw/intc/arm_gicv3: fix prio masking on pmr write Date: Mon, 14 Nov 2022 15:52:01 +0000 Message-Id: <20221114155201.425027-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221114155201.425027-1-peter.maydell@linaro.org> References: <20221114155201.425027-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.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 From: Jens Wiklander With commit 39f29e599355 ("hw/intc/arm_gicv3: Use correct number of priority bits for the CPU") the number of priority bits was changed from the maximum value 8 to typically 5. As a consequence a few of the lowest bits in ICC_PMR_EL1 becomes RAZ/WI. However prior to this patch one of these bits was still used since the supplied priority value is masked before it's eventually right shifted with one bit. So the bit is not lost as one might expect when the register is read again. The Linux kernel depends on lowest valid bit to be reset to zero, see commit 33625282adaa ("irqchip/gic-v3: Probe for SCR_EL3 being clear before resetting AP0Rn") for details. So fix this by masking the priority value after it may have been right shifted by one bit. Cc: qemu-stable@nongnu.org Fixes: 39f29e599355 ("hw/intc/arm_gicv3: Use correct number of priority bits for the CPU") Signed-off-by: Jens Wiklander Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_cpuif.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c index 8ca630e5ad1..b17b29288c7 100644 --- a/hw/intc/arm_gicv3_cpuif.c +++ b/hw/intc/arm_gicv3_cpuif.c @@ -1016,8 +1016,6 @@ static void icc_pmr_write(CPUARMState *env, const ARMCPRegInfo *ri, trace_gicv3_icc_pmr_write(gicv3_redist_affid(cs), value); - value &= icc_fullprio_mask(cs); - if (arm_feature(env, ARM_FEATURE_EL3) && !arm_is_secure(env) && (env->cp15.scr_el3 & SCR_FIQ)) { /* NS access and Group 0 is inaccessible to NS: return the @@ -1029,6 +1027,7 @@ static void icc_pmr_write(CPUARMState *env, const ARMCPRegInfo *ri, } value = (value >> 1) | 0x80; } + value &= icc_fullprio_mask(cs); cs->icc_pmr_el1 = value; gicv3_cpuif_update(cs); }