From patchwork Tue Jun 19 01:43:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 931258 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SGXlALDf"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 418rpy6ftxz9s3C for ; Tue, 19 Jun 2018 12:03:38 +1000 (AEST) Received: from localhost ([::1]:38473 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV5zc-0006Mv-Gf for incoming@patchwork.ozlabs.org; Mon, 18 Jun 2018 22:03:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV5h0-0000UN-Tv for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:44:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fV5gz-0007qd-Vj for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:44:22 -0400 Received: from mail-ot0-x22a.google.com ([2607:f8b0:4003:c0f::22a]:40162) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fV5gz-0007qT-Qu; Mon, 18 Jun 2018 21:44:21 -0400 Received: by mail-ot0-x22a.google.com with SMTP id w9-v6so20743559otj.7; Mon, 18 Jun 2018 18:44:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=kW8B5TzAlLDjHDgPY3ayuMehlo6xTvmuvLr+9s2pQkU=; b=SGXlALDf73iI+tvH2b9qmGhVCi6fsykr6FrmMsD5V+BUXpFrvrwrcmD0NbEs9ewchH 89d8ddbSMTXVDMYro+kl1GsrFpklUQ0h06nmSP7VSldy9JOByORPwkfOQWxUUG0wKcJ1 QFBXUTNO/EhYNjoKl0rzc3VBRbyI1Rz5KMH8+5fC6L8BsdOtrNUW08Cgg79Hd2uvmRxl cV998NxlEE8hbjl4UMWzI9XW4hP4kCrlPKd/Q+tyo0FhT/GGVNadnsp/vvBEugbkLZ+0 tFQa1cw6qOwmLRM/e4Wm2U6fbhO/Zk0QoA47n6f0eUyhCPsNXiBAf7cPCdxOPfRJbaDT yTWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=kW8B5TzAlLDjHDgPY3ayuMehlo6xTvmuvLr+9s2pQkU=; b=q3qaMB+IIBbVcqF2Uj3IPKNY8RaJ+kTPXBrGuyz2z0hM1FZvPLSitvgEZrn4vg9btE +XhjjbceVWOqG7Za0X0saoq/1QnVwiXtRT1pnAQIs6oPg2reeSV/nCClT0mQ+Kg50Vkl +XAUcBN9Mm/yMTVj/ii4/sgfCuLIv6XfOiy4O5OlLSF4THzjgUKmJzjcri4Tkl8meYrR L61eqr+xkmaHxL6+CfejbtuG4xKSdpd9D9mgCfrzL2egr6Js2ibN9qJ/1sRcPkw5EWpI DujKnkR2DCbN6lcooB+VQ40can8VU98ua6L9/zRtiG05sMthF5JjENXQ/Y1HKar/b2kl ur4Q== X-Gm-Message-State: APt69E0lSOqVTr9XxtcTVdGOnZuY+eOpgKiH11QhUQdDrx6d2dkfqg4w a5HPjua6vX9Slm2DfUVo4WUS3xfw X-Google-Smtp-Source: ADUXVKJVCE1nms/o2eXBQqHcDkCeqJMsSNVnbytHmQWx2vShkoqlMrchO6bt8lFljf5OjvUOO2aHFA== X-Received: by 2002:a9d:577d:: with SMTP id x58-v6mr9824703oti.196.1529372660594; Mon, 18 Jun 2018 18:44:20 -0700 (PDT) Received: from localhost ([2600:1700:70:e488:b0ee:9bda:ee6f:91be]) by smtp.gmail.com with ESMTPSA id k47-v6sm9220860otb.50.2018.06.18.18.44.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 18:44:19 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 20:43:19 -0500 Message-Id: <20180619014319.28272-114-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> References: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c0f::22a Subject: [Qemu-devel] [PATCH 113/113] arm_gicv3_kvm: kvm_dist_get/put_priority: skip the registers banked by GICR_IPRIORITYR X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-stable@nongnu.org, Shannon Zhao Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Shannon Zhao While for_each_dist_irq_reg loop starts from GIC_INTERNAL, it forgot to offset the date array and index. This will overlap the GICR registers value and leave the last GIC_INTERNAL irq's registers out of update. Fixes: 367b9f527becdd20ddf116e17a3c0c2bbc486920 Cc: qemu-stable@nongnu.org Reviewed-by: Peter Maydell Reviewed-by: Eric Auger Signed-off-by: Shannon Zhao Signed-off-by: Peter Maydell (cherry picked from commit 1dcf3675196a1cec616ce71b067d9498590a60a6) Signed-off-by: Michael Roth --- hw/intc/arm_gicv3_kvm.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c index 550fd13525..3fff4687ee 100644 --- a/hw/intc/arm_gicv3_kvm.c +++ b/hw/intc/arm_gicv3_kvm.c @@ -135,7 +135,14 @@ static void kvm_dist_get_priority(GICv3State *s, uint32_t offset, uint8_t *bmp) uint32_t reg, *field; int irq; - field = (uint32_t *)bmp; + /* For the KVM GICv3, affinity routing is always enabled, and the first 8 + * GICD_IPRIORITYR registers are always RAZ/WI. The corresponding + * functionality is replaced by GICR_IPRIORITYR. It doesn't need to + * sync them. So it needs to skip the field of GIC_INTERNAL irqs in bmp and + * offset. + */ + field = (uint32_t *)(bmp + GIC_INTERNAL); + offset += (GIC_INTERNAL * 8) / 8; for_each_dist_irq_reg(irq, s->num_irq, 8) { kvm_gicd_access(s, offset, ®, false); *field = reg; @@ -149,7 +156,14 @@ static void kvm_dist_put_priority(GICv3State *s, uint32_t offset, uint8_t *bmp) uint32_t reg, *field; int irq; - field = (uint32_t *)bmp; + /* For the KVM GICv3, affinity routing is always enabled, and the first 8 + * GICD_IPRIORITYR registers are always RAZ/WI. The corresponding + * functionality is replaced by GICR_IPRIORITYR. It doesn't need to + * sync them. So it needs to skip the field of GIC_INTERNAL irqs in bmp and + * offset. + */ + field = (uint32_t *)(bmp + GIC_INTERNAL); + offset += (GIC_INTERNAL * 8) / 8; for_each_dist_irq_reg(irq, s->num_irq, 8) { reg = *field; kvm_gicd_access(s, offset, ®, true);