From patchwork Fri Apr 22 10:04:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564806 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp353375map; Fri, 22 Apr 2022 03:53:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWWRAZWD8Akru+tsCIRhnhi+haEI35M4evhKtYe88WYUVyPD0P6e4qLBNqPQnURPBRqNmt X-Received: by 2002:a05:620a:6db:b0:69e:84e3:5059 with SMTP id 27-20020a05620a06db00b0069e84e35059mr2140034qky.709.1650624811718; Fri, 22 Apr 2022 03:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650624811; cv=none; d=google.com; s=arc-20160816; b=Rvv1W0cSU5J/ZsZoP26gNSO5Ez6N8XdtzI8Cztzp5tAzXJmNHZuPMpZNnwfYO93+9x +tseiEBLJV0TEXy4dWii3YCWiEzBxfLA1iWh7FbDjKIyNAvfFHa4MPuDR8iqxT/e6Iui 4FStlNLN49eIX3N1HsidGFfjCIITi9I9slcyJf8OZNyopl39Hl/nM/zrIVFunyvmseL/ ZMLujG96/0beeAcNCW0L+5Ku+XT3yy4OQPmWBLXG95O+PSgAsvyYp7Bzcr5cinOxLPHS p9mxBqHVEvL6PUI/0SW/nvuhrS3u+WUAVykdrpblLlxMNAGptLKuY6vas9wJc5Vyve9o /kKA== 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=JusjhwmCYsYrAoBkrOFAzh+RoRO01/bInTb0P5AYwvE=; b=nwR0F+kQpRh5ysY0hrWi1Qr5NGs5AixMK7L0vpka4Arq2BF/5IRONForXlxo7qIoN1 +BZEO2E4iWPVMlr489AuGXeBdmChRQBe8HRlYKNiw+z5dff8QhNmDtWT58FQLjUJtGxr Yr/9VAOyizwCC5tLs+YHJiZgghd4Rw87i+V4PCy2FOFsHFFMqEl5lVaFFcbUFui2M/Rk vcmcw5M+JF+96mVNb1V1Pth5bzEqurhav7RoK3brU2tYCDCIEgav64T8FMaNK2jkTu0v Q0GIGaFDgxvnVfIWcRZizQZyUEZv1yrtarXArSCI7iNBPIlEEOpu1fSC7Tv24rc2FFis WGGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z0KuIr0e; 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 o11-20020a0562140e4b00b004466c300c0fsi2124578qvc.396.2022.04.22.03.53.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:53: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=Z0KuIr0e; 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]:44320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqup-0000qp-59 for patch@linaro.org; Fri, 22 Apr 2022 06:53:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqA4-00050s-UM for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:13 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:36815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqA3-0002ru-7Y for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:12 -0400 Received: by mail-wm1-x335.google.com with SMTP id u17-20020a05600c211100b0038eaf4cdaaeso7631626wml.1 for ; Fri, 22 Apr 2022 03:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=JusjhwmCYsYrAoBkrOFAzh+RoRO01/bInTb0P5AYwvE=; b=Z0KuIr0eLj+gAGyOmHaDaqJWTv4aAbxESISDcj83njDvBGh6uK1E0vY68ae2lPjFlg VPvp5lJsGQngVguRBLq7PbVh6h2lyP7Fdiy1HXvMnVw5IRo1qFxTqqHJ+N+uWNCQFOYE 4AQ9ggBA6hIyM/JZeKG2Ot1OEwg4qL1t3aJV7d1d0YWJF74AGa68QYOcGHehtdsnWesC cTNtSW4Q01l6Bq7Pj/BFfxhfGR5hXmxPaJb5DAvPsvKXXkGtPS0Hub+PH1gghe+Q85nF AQhd3+GKVV7PwTEZr8WsBidzgKjNmza8K70+0XHBvvlhaWonYMuXu/2iWDo9mlTLBR1v htlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JusjhwmCYsYrAoBkrOFAzh+RoRO01/bInTb0P5AYwvE=; b=JZESNXMiGyvVY5vIP1yVB97S5YwzKVW/A54Vb3sUjfTZ/qVf+9z9kK8icXQIoPDCAS EpHR/wqOkXs8qJiPF76tHpKNQlsp9bdNqzmrvnBcBnAI8sV0SMzbZ//we0UarOy2eosZ /TgvEXlqa+oC0svhyzsmStZs1PWRS/M5SRUzhAh7nUe/hHbaSJGz9d4HrkOppUSUcqtv 7b2nHa8lCSzhYQiSVlHfI5swgHCgvvKexhN26df1WME5F8Fk6f+ee5DMwshNuv+3zDZA UNCegNkxzt/JJkzDSxSV6uoLaVTX3FYpWCJyqKUaBiQF4W9yQ4FShb5Gq/Bqdk5qwqyr 9wLw== X-Gm-Message-State: AOAM532+WcBA7Db4yXWITeW4/L/Oajc3q441pgtGw/k3u+MnNl2f/xkG oSSpFIYx5Nf2qUo3sQ2fT7tZgudHuGD/tg== X-Received: by 2002:a05:600c:3785:b0:38e:bca8:f0c1 with SMTP id o5-20020a05600c378500b0038ebca8f0c1mr12346874wmr.56.1650621909744; Fri, 22 Apr 2022 03:05:09 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:09 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 38/61] hw/intc/arm_gicv3: Allow 'revision' property to be set to 4 Date: Fri, 22 Apr 2022 11:04:09 +0100 Message-Id: <20220422100432.2288247-39-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-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" Now that we have implemented all the GICv4 requirements, relax the error-checking on the GIC object's 'revision' property to allow a TCG GIC to be a GICv4, whilst still constraining the KVM GIC to GICv3. Our 'revision' property doesn't consider the possibility of wanting to specify the minor version of the GIC -- for instance there is a GICv3.1 which adds support for extended SPI and PPI ranges, among other things, and also GICv4.1. But since the QOM property is internal to QEMU, not user-facing, we can cross that bridge when we come to it. Within the GIC implementation itself code generally checks against the appropriate ID register feature bits, and the only use of s->revision is for setting those ID register bits. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-39-peter.maydell@linaro.org --- hw/intc/arm_gicv3_common.c | 12 +++++++----- hw/intc/arm_gicv3_kvm.c | 5 +++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index 181f342f32c..5634c6fc788 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -326,12 +326,14 @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) GICv3State *s = ARM_GICV3_COMMON(dev); int i, rdist_capacity, cpuidx; - /* revision property is actually reserved and currently used only in order - * to keep the interface compatible with GICv2 code, avoiding extra - * conditions. However, in future it could be used, for example, if we - * implement GICv4. + /* + * This GIC device supports only revisions 3 and 4. The GICv1/v2 + * is a separate device. + * Note that subclasses of this device may impose further restrictions + * on the GIC revision: notably, the in-kernel KVM GIC doesn't + * support GICv4. */ - if (s->revision != 3) { + if (s->revision != 3 && s->revision != 4) { error_setg(errp, "unsupported GIC revision %d", s->revision); return; } diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c index 5ec5ff9ef6e..06f5aceee52 100644 --- a/hw/intc/arm_gicv3_kvm.c +++ b/hw/intc/arm_gicv3_kvm.c @@ -781,6 +781,11 @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp) return; } + if (s->revision != 3) { + error_setg(errp, "unsupported GIC revision %d for in-kernel GIC", + s->revision); + } + if (s->security_extn) { error_setg(errp, "the in-kernel VGICv3 does not implement the " "security extensions");