Received: by 2002:a17:906:3588:b0:a45:b507:d90a with SMTP id o8csp28955ejb; Tue, 5 Mar 2024 10:08:17 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVU1vhBJTJILHEYTr8pybrB9B9HTcVkfvaEeSkA298umV9SMGG5Rp3iK4ZoEopxyVgMuLfS0YEEk3MBRNy+hYpvJgbTrsus X-Google-Smtp-Source: AGHT+IE6vywH74YF3inAemuO85CCoRwlV9IknI5LYraXAm4UCmTT96b88sYRG8FnFO/sKM0DKVLK X-Received: by 2002:a05:620a:568b:b0:788:2e84:4ae7 with SMTP id wg11-20020a05620a568b00b007882e844ae7mr2569533qkn.62.1709662096753; Tue, 05 Mar 2024 10:08:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709662096; cv=none; d=google.com; s=arc-20160816; b=OJmoXJsaM70jPvbCJTHEkiKJ2uXruxNsapb20ndr++isdjgbIOnxnhbgEtXZBMZlt7 +kNVDtyNmQit77xWwIc+6XQV8YuQKqsIEH/JkKlaXJv4Ip3Eauvtpz6tz1JSC9Y4Gfbw ENV/oj6TrL6sgfetwQFAmrJmXd+Dw7EaYFRfyBPeylwEppkdMmYHsvwFC2Lpig3c/NOI cUym8Dn5CDuvMLXrxf1/JyU9qx5hV2oOQEiFsXPtqFkidu7qaPypIxcDlnrLTq7fm/XW 4TIZ5059MeGASsAJx2YiBtnOAHHUmAOlBYpjNK22vkBRGHqEvX5ycOY/Zz1cAQqOiNKR VrHA== 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=CQdBQ55XBD1zKpk7OKKORm1TNObn+aTFGDtbgCuAoGo=; fh=RVuuaU7Ghp1omAcM/aHHQKcSvJxs+IjfJSTvOY2eDr8=; b=MxLLOkQaeYi8XfBTbBDTbgAHidYiLuzOZ+tUmxXrQy7Lmae9lISYFZXcb0dghAotGM OctC4IFy5oZQpe0s2Oqso/I2EzfSEl+hpVTKHl64dnB1lz2pH/S0LlcH0E9Uzlmv18Dz 98+yFxf/cynm0MvkA+PWmikghjtyVf4kzaoonHfeve3z/ZX4Ehp/I0cEeszcpe2VB3UO 9g51LD/Pvjj4E2G2TMemN8C5p4rt7RX/WBx5IimYFc10nFx9obbWrBOR+gLMNA5RHz8o zJ4lMJLyBVCYJX8ZqbXBhHKdWb7bfFRf6yWJRnLBftTxxu7hMU3Bkp4goC0C9HZQxikK J8LA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DqDR7wm6; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id de16-20020a05620a371000b00787f411427esi14055400qkb.757.2024.03.05.10.08.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Mar 2024 10:08:16 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=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=@redhat.com header.s=mimecast20190719 header.b=DqDR7wm6; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhZCi-0001qS-Dw; Tue, 05 Mar 2024 13:07:52 -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 1rhZCh-0001pa-Mu for qemu-arm@nongnu.org; Tue, 05 Mar 2024 13:07:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhZCe-0008S4-NB for qemu-arm@nongnu.org; Tue, 05 Mar 2024 13:07:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709662067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CQdBQ55XBD1zKpk7OKKORm1TNObn+aTFGDtbgCuAoGo=; b=DqDR7wm6pniKw7YF7v6L5hRdAaIatYKUurUzY7xTzhlR6E2+UGy0FxHjFUAjYWW6Mk9KVg 4k9vAPUi+tW9o9koelev1atetw7o+cJydwIwYIrc99lbHpTVr/G94usH0PAMysnR8VmWLE qQgIWpuf+63ThedexvwcVX1FUrika5c= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-215-ofT2HaHJMfW63cDZse_RHg-1; Tue, 05 Mar 2024 13:07:45 -0500 X-MC-Unique: ofT2HaHJMfW63cDZse_RHg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8D5351C01504; Tue, 5 Mar 2024 18:07:44 +0000 (UTC) Received: from laptop.redhat.com (unknown [10.39.193.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 21295C041F1; Tue, 5 Mar 2024 18:07:40 +0000 (UTC) From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, mst@redhat.com, jean-philippe@linaro.org, imammedo@redhat.com, peter.maydell@linaro.org, clg@redhat.com, yanghliu@redhat.com, zhenzhong.duan@intel.com Cc: alex.williamson@redhat.com, jasowang@redhat.com, pbonzini@redhat.com, berrange@redhat.com Subject: [PATCH v6 1/9] qdev: Add a granule_mode property Date: Tue, 5 Mar 2024 19:06:19 +0100 Message-ID: <20240305180734.48515-2-eric.auger@redhat.com> In-Reply-To: <20240305180734.48515-1-eric.auger@redhat.com> References: <20240305180734.48515-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass client-ip=170.10.129.124; envelope-from=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.568, 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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@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-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org X-TUID: BomzfjEF3BoA Introduce a new enum type property allowing to set an IOMMU granule. Values are 4k, 8k, 16k, 64k and host. This latter indicates the vIOMMU granule will match the host page size. A subsequent patch will add such a property to the virtio-iommu device. Signed-off-by: Eric Auger Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Zhenzhong Duan --- v5 -> v6 - remove #include "hw/virtio/virtio-iommu.h" (Zhenzhong) v4 -> v5 - remove code that can be automatically generated and add the new enum in qapi/virtio.json (Philippe). Added Phild's SOB. low case needs to be used due to the Jason generation. v3 -> v4: - Add 8K --- qapi/virtio.json | 18 ++++++++++++++++++ include/hw/qdev-properties-system.h | 3 +++ hw/core/qdev-properties-system.c | 14 ++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/qapi/virtio.json b/qapi/virtio.json index a79013fe89..95745fdfd7 100644 --- a/qapi/virtio.json +++ b/qapi/virtio.json @@ -957,3 +957,21 @@ { 'struct': 'DummyVirtioForceArrays', 'data': { 'unused-iothread-vq-mapping': ['IOThreadVirtQueueMapping'] } } + +## +# @GranuleMode: +# +# @4k: granule page size of 4KiB +# +# @8k: granule page size of 8KiB +# +# @16k: granule page size of 16KiB +# +# @64k: granule page size of 64KiB +# +# @host: granule matches the host page size +# +# Since: 9.0 +## +{ 'enum': 'GranuleMode', + 'data': [ '4k', '8k', '16k', '64k', 'host' ] } diff --git a/include/hw/qdev-properties-system.h b/include/hw/qdev-properties-system.h index 06c359c190..626be87dd3 100644 --- a/include/hw/qdev-properties-system.h +++ b/include/hw/qdev-properties-system.h @@ -8,6 +8,7 @@ extern const PropertyInfo qdev_prop_macaddr; extern const PropertyInfo qdev_prop_reserved_region; extern const PropertyInfo qdev_prop_multifd_compression; extern const PropertyInfo qdev_prop_mig_mode; +extern const PropertyInfo qdev_prop_granule_mode; extern const PropertyInfo qdev_prop_losttickpolicy; extern const PropertyInfo qdev_prop_blockdev_on_error; extern const PropertyInfo qdev_prop_bios_chs_trans; @@ -47,6 +48,8 @@ extern const PropertyInfo qdev_prop_iothread_vq_mapping_list; #define DEFINE_PROP_MIG_MODE(_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_mig_mode, \ MigMode) +#define DEFINE_PROP_GRANULE_MODE(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_granule_mode, GranuleMode) #define DEFINE_PROP_LOSTTICKPOLICY(_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_losttickpolicy, \ LostTickPolicy) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 1a396521d5..b45e90edb2 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -679,6 +679,20 @@ const PropertyInfo qdev_prop_mig_mode = { .set_default_value = qdev_propinfo_set_default_value_enum, }; +/* --- GranuleMode --- */ + +QEMU_BUILD_BUG_ON(sizeof(GranuleMode) != sizeof(int)); + +const PropertyInfo qdev_prop_granule_mode = { + .name = "GranuleMode", + .description = "granule_mode values, " + "4k, 8k, 16k, 64k, host", + .enum_table = &GranuleMode_lookup, + .get = qdev_propinfo_get_enum, + .set = qdev_propinfo_set_enum, + .set_default_value = qdev_propinfo_set_default_value_enum, +}; + /* --- Reserved Region --- */ /* -- 2.41.0