[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CABVzXA=_S2in+OzfwK6vGQR3VK3YhGRu4B+tp5oCZKHt0Qz=gw@mail.gmail.com>
Date: Thu, 20 Feb 2025 11:19:47 -0800
From: Daniel Verkamp <dverkamp@...omium.org>
To: Sergio Lopez <slp@...hat.com>
Cc: "Michael S. Tsirkin" <mst@...hat.com>, Jason Wang <jasowang@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, Eugenio Pérez <eperezma@...hat.com>,
David Airlie <airlied@...hat.com>, Gerd Hoffmann <kraxel@...hat.com>,
Gurchetan Singh <gurchetansingh@...omium.org>, Chia-I Wu <olvaffe@...il.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>, Simona Vetter <simona@...ll.ch>, Rob Clark <robdclark@...il.com>,
Dmitry Osipenko <dmitry.osipenko@...labora.com>, fnkl.kernel@...il.com,
virtualization@...ts.linux.dev, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH RFC v3 2/4] virtio-pci: extend virtio_pci_cap with page_shift
On Thu, Feb 20, 2025 at 6:30 AM Sergio Lopez <slp@...hat.com> wrote:
[...]
> @@ -829,6 +839,7 @@ static int virtio_pci_find_shm_cap(struct pci_dev *dev, u8 required_id,
> *bar = res_bar;
> *offset = res_offset;
> *len = res_length;
> + *page_size = 1 << (page_shift + 12);
Maybe this should validate that page_shift is in range to avoid any
funny business from the device; since page_size is u32, this needs
page_shift + 12 < 32. (If it's out of range, I am not sure what this
should do; maybe just warn and set it to the default 4096?)
Also shifting into the sign bit is technically undefined (or
implementation-defined? I don't recall) behavior, so perhaps make the
constant unsigned, e.g. `1U << (page_shift + 12)`.
Other than that, looks reasonable to me:
Reviewed-by: Daniel Verkamp <dverkamp@...omium.org>
Thanks,
-- Daniel
Powered by blists - more mailing lists