qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Auger <eric.auger@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	eric.auger.pro@gmail.com, qemu-devel@nongnu.org,
	qemu-arm@nongnu.org, mst@redhat.com, jean-philippe@linaro.org,
	peter.maydell@linaro.org, clg@redhat.com, yanghliu@redhat.com
Cc: alex.williamson@redhat.com, zhenzhong.duan@intel.com,
	jasowang@redhat.com, pbonzini@redhat.com, berrange@redhat.com
Subject: Re: [PATCH v4 2/3] virtio-iommu: Add a granule property
Date: Fri, 23 Feb 2024 09:36:21 +0100	[thread overview]
Message-ID: <97b34139-eb49-492c-b77c-fe389f11b60b@redhat.com> (raw)
In-Reply-To: <fcca3389-7862-4ecc-865a-404091e3d697@linaro.org>



On 2/23/24 08:57, Philippe Mathieu-Daudé wrote:
> On 23/2/24 08:27, Eric Auger wrote:
>> This allows to choose which granule will be used by
>> default by the virtio-iommu. Current page size mask
>> default is qemu_target_page_mask so this translates
>> into a 4K granule.
>>
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>>
>> ---
>>
>> v3 -> v4:
>> - granule_mode introduction moved to that patch
>> ---
>>   include/hw/virtio/virtio-iommu.h |  1 +
>>   hw/virtio/virtio-iommu.c         | 27 ++++++++++++++++++++++++---
>>   qemu-options.hx                  |  3 +++
>>   3 files changed, 28 insertions(+), 3 deletions(-)
>
>
>> @@ -1324,7 +1324,26 @@ static void
>> virtio_iommu_device_realize(DeviceState *dev, Error **errp)
>>        * in vfio realize
>>        */
>>       s->config.bypass = s->boot_bypass;
>> -    s->config.page_size_mask = qemu_target_page_mask();
>> +
>> +    switch (s->granule_mode) {
>> +    case GRANULE_MODE_4K:
>> +        s->config.page_size_mask = ~0xFFF;
>
> Alternatively:
>
>           s->config.page_size_mask = -(4 * KiB);
Yep that's more readable.

Thanks

Eric
>
>> +        break;
>> +    case GRANULE_MODE_8K:
>> +        s->config.page_size_mask = ~0x1FFF;
>
>           s->config.page_size_mask = -(8 * KiB);
>
>> +        break;
>> +    case GRANULE_MODE_16K:
>> +        s->config.page_size_mask = ~0x3FFF;
>
> ...
>
>> +        break;
>> +    case GRANULE_MODE_64K:
>> +        s->config.page_size_mask = ~0xFFFF;
>> +        break;
>> +    case GRANULE_MODE_HOST:
>> +        s->config.page_size_mask = qemu_real_host_page_mask();
>> +        break;
>> +    default:
>> +        error_setg(errp, "Unsupported granule mode");
>> +    }
>



  reply	other threads:[~2024-02-23  8:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-23  7:27 [PATCH v4 0/3] VIRTIO-IOMMU: Set default granule to host page size Eric Auger
2024-02-23  7:27 ` [PATCH v4 1/3] qdev: Add a granule_mode property Eric Auger
2024-02-23  7:52   ` Philippe Mathieu-Daudé
2024-02-23  8:30     ` Eric Auger
2024-02-23 11:39       ` Philippe Mathieu-Daudé
2024-02-23  7:27 ` [PATCH v4 2/3] virtio-iommu: Add a granule property Eric Auger
2024-02-23  7:57   ` Philippe Mathieu-Daudé
2024-02-23  8:36     ` Eric Auger [this message]
2024-02-23  7:27 ` [PATCH v4 3/3] virtio-iommu: Change the default granule to the host page size Eric Auger
2024-02-23  8:08   ` Philippe Mathieu-Daudé
2024-02-23  8:38     ` Eric Auger
2024-02-23 11:33       ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97b34139-eb49-492c-b77c-fe389f11b60b@redhat.com \
    --to=eric.auger@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=berrange@redhat.com \
    --cc=clg@redhat.com \
    --cc=eric.auger.pro@gmail.com \
    --cc=jasowang@redhat.com \
    --cc=jean-philippe@linaro.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=yanghliu@redhat.com \
    --cc=zhenzhong.duan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).