From patchwork Wed Jun 30 15:31:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shashi Mallela X-Patchwork-Id: 468706 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp468675jao; Wed, 30 Jun 2021 08:43:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCI7IrPB99pgSLWUrw1M4OiphadnKqms1BRJvOF90SvUB8BUFLkFcrpVczgOyWYk91qTpW X-Received: by 2002:aa7:c70d:: with SMTP id i13mr47862736edq.249.1625067800633; Wed, 30 Jun 2021 08:43:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625067800; cv=none; d=google.com; s=arc-20160816; b=YLC23J64BDzmd1ydjIUXZXGt044HP3eoSnZClm/KBQ2SpZaTJkKIzQrPb8dMVUJOfT 2ogSYEOHO7lnWWVGmsf07E3mT2D9yOr3w5F4O+aW5zY/kx5XwNq1ENitR2MSPRzPpgkH eWtaSclfZdYusNYgTd0iyIZd4N/xZ5/D37kRBU4Lxgng1nCT/WLFj6eQRm3KcHoV19CP ZPAmwnvlUPHEWfnfku6zzZi9g4yLTaQPkPhC8ezoMpQUgSVFv2h4Si3+RGat25GIV/3a iCh7H7bIvxwVsIZ/bxKc678akFHlkpCCBZiSVKtU9CNroB3J7Blsq6LjEoel7kGZahXk t9aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=YQc7hngRcXAxMgbGTFQRDdYH/dKN+DPW0PpKb5MWZc4=; b=H85cfsb08jtpveuYH5/m3S1qLQSxuXchEAxDIHXZ2+FZ8whw7Wav5xn35dqr3GFtpZ OWSUX6KSrfgVvynP2bXR+hKhXelZ2HZEru1ZxXfQj67KCwkG0NjB5O10InpjVNZ2/rXM eQGAI5Mzztqdj828zbHZSn8vj/o+eGpjWCCv0R4mNiH97UUrfR0l7rfK/YOm39vVYbha DtLiyh2D4NHl93dixmyY8+/CW8qTJnxqRpgapQVnml3PDG3xOriom+HtHiBlwBbIXFhv c65f/KnuGjxx4uJwLyoEOhZskjNuQTcyNLWff7ereyzXA+Hya4aV1EzzOXTimEz0T8kU 4Gyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hE4XgNUA; 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 s22si15356246ejv.579.2021.06.30.08.43.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Jun 2021 08:43:20 -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=hE4XgNUA; 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]:52436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lycMx-0007Lj-HW for patch@linaro.org; Wed, 30 Jun 2021 11:43:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lycCS-0005Rp-AB for qemu-devel@nongnu.org; Wed, 30 Jun 2021 11:32:28 -0400 Received: from mail-qv1-xf2c.google.com ([2607:f8b0:4864:20::f2c]:34343) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lycC6-000592-Nt for qemu-devel@nongnu.org; Wed, 30 Jun 2021 11:32:28 -0400 Received: by mail-qv1-xf2c.google.com with SMTP id h18so1308570qve.1 for ; Wed, 30 Jun 2021 08:32:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YQc7hngRcXAxMgbGTFQRDdYH/dKN+DPW0PpKb5MWZc4=; b=hE4XgNUAYOnRMhFlNrFGk2KrqxPbRCIUCfAyfzzd2uBTvVsHaonknegXtb0Zovka1s 1x/re/nDf52LYz7pIGZs+Y/FxjxUzVLAYd+urfUersB0s7NYkdFtM0GfOWEWHMs94Mr1 MfwEX3L8ZAZOpRWnKq5/NKNt8ucV+bhCnOLSFQKnhyax2Pl9KQv5UDhKOemlZplzE79t M2QKONbecVNBZBN9Ozzw3Gwq41DBP3xkE316JH37jwvx7brHn/c96kPrtVptVs4amug3 wZNRUx/nermsuNAL/46jqnAJgL27kwy/33iGSrWxTLK0zrlsLS5pTlb01P2LppU6fhAk 4XmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YQc7hngRcXAxMgbGTFQRDdYH/dKN+DPW0PpKb5MWZc4=; b=IaJypivNcxEFCP62QM7Zb0pJjCdulqEAh11fwpLw7qPNIOLZf6YDqso7C+sgY7rfdb 8ccyxHuDoWtAhc2pEyJ5L1DLrKak/C/4NlQR7/1IDXUUN9uOyKq/gGR6wHmyjuNwuv8U 9Loj2kxA2hyZbERdAvIzliGrvCmYs+6lQVOaYarkjWAW3w03De2NVYhM0lYSWIpJX4JR R3ISg2TqnbMBkYn3YI7aK5bH2hDMaU1NMxBnzGM2woLNqv/6QAxFCAAj2gk1ScDLmh5C O3NmcekVqnGjTJ+rIwg9Xg9XWLJpRkqSBTGYXtVrcb5ErcMYk6vZrAX16Dw65o53CXsZ Kg8w== X-Gm-Message-State: AOAM532UOGshkNDMAB8Sfmg2WeruqtHCxGKJsdZixF2Av4W/lYf4zpE/ zZNpbhAR0xAKtewOBn80XPOzAA== X-Received: by 2002:a05:6214:b08:: with SMTP id u8mr37699872qvj.52.1625067125867; Wed, 30 Jun 2021 08:32:05 -0700 (PDT) Received: from localhost.localdomain (bras-base-stsvon1503w-grc-22-142-114-143-47.dsl.bell.ca. [142.114.143.47]) by smtp.googlemail.com with ESMTPSA id 4sm836131qkm.100.2021.06.30.08.32.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 08:32:05 -0700 (PDT) From: Shashi Mallela To: peter.maydell@linaro.org, leif@nuviainc.com, rad@semihalf.com, mst@redhat.com, imammedo@redhat.com Subject: [PATCH v5 09/10] hw/arm/virt: add ITS support in virt GIC Date: Wed, 30 Jun 2021 11:31:55 -0400 Message-Id: <20210630153156.9421-10-shashi.mallela@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210630153156.9421-1-shashi.mallela@linaro.org> References: <20210630153156.9421-1-shashi.mallela@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f2c; envelope-from=shashi.mallela@linaro.org; helo=mail-qv1-xf2c.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Included creation of ITS as part of virt platform GIC initialization. This Emulated ITS model now co-exists with kvm ITS and is enabled in absence of kvm irq kernel support in a platform. Signed-off-by: Shashi Mallela Reviewed-by: Peter Maydell --- hw/arm/virt.c | 28 ++++++++++++++++++++++++++-- include/hw/arm/virt.h | 2 ++ target/arm/kvm_arm.h | 4 ++-- 3 files changed, 30 insertions(+), 4 deletions(-) -- 2.27.0 diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 4b96f06014..1d8c44685c 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -583,6 +583,12 @@ static void create_its(VirtMachineState *vms) const char *itsclass = its_class_name(); DeviceState *dev; + if (!strcmp(itsclass, "arm-gicv3-its")) { + if (!vms->tcg_its) { + itsclass = NULL; + } + } + if (!itsclass) { /* Do nothing if not supported */ return; @@ -620,7 +626,7 @@ static void create_v2m(VirtMachineState *vms) vms->msi_controller = VIRT_MSI_CTRL_GICV2M; } -static void create_gic(VirtMachineState *vms) +static void create_gic(VirtMachineState *vms, MemoryRegion *mem) { MachineState *ms = MACHINE(vms); /* We create a standalone GIC */ @@ -654,6 +660,14 @@ static void create_gic(VirtMachineState *vms) nb_redist_regions); qdev_prop_set_uint32(vms->gic, "redist-region-count[0]", redist0_count); + if (!kvm_irqchip_in_kernel()) { + if (vms->tcg_its) { + object_property_set_link(OBJECT(vms->gic), "sysmem", + OBJECT(mem), &error_fatal); + qdev_prop_set_bit(vms->gic, "has-lpi", true); + } + } + if (nb_redist_regions == 2) { uint32_t redist1_capacity = vms->memmap[VIRT_HIGH_GIC_REDIST2].size / GICV3_REDIST_SIZE; @@ -2039,7 +2053,7 @@ static void machvirt_init(MachineState *machine) virt_flash_fdt(vms, sysmem, secure_sysmem ?: sysmem); - create_gic(vms); + create_gic(vms, sysmem); virt_cpu_post_init(vms, sysmem); @@ -2720,6 +2734,12 @@ static void virt_instance_init(Object *obj) } else { /* Default allows ITS instantiation */ vms->its = true; + + if (vmc->no_tcg_its) { + vms->tcg_its = false; + } else { + vms->tcg_its = true; + } } /* Default disallows iommu instantiation */ @@ -2766,8 +2786,12 @@ DEFINE_VIRT_MACHINE_AS_LATEST(6, 1) static void virt_machine_6_0_options(MachineClass *mc) { + VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); + virt_machine_6_1_options(mc); compat_props_add(mc->compat_props, hw_compat_6_0, hw_compat_6_0_len); + /* qemu ITS was introduced with 6.1 */ + vmc->no_tcg_its = true; } DEFINE_VIRT_MACHINE(6, 0) diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 921416f918..f873ab9068 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -120,6 +120,7 @@ struct VirtMachineClass { MachineClass parent; bool disallow_affinity_adjustment; bool no_its; + bool no_tcg_its; bool no_pmu; bool claim_edge_triggered_timers; bool smbios_old_sys_ver; @@ -141,6 +142,7 @@ struct VirtMachineState { bool highmem; bool highmem_ecam; bool its; + bool tcg_its; bool virt; bool ras; bool mte; diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h index 34f8daa377..0613454975 100644 --- a/target/arm/kvm_arm.h +++ b/target/arm/kvm_arm.h @@ -525,8 +525,8 @@ static inline const char *its_class_name(void) /* KVM implementation requires this capability */ return kvm_direct_msi_enabled() ? "arm-its-kvm" : NULL; } else { - /* Software emulation is not implemented yet */ - return NULL; + /* Software emulation based model */ + return "arm-gicv3-its"; } }