Re: [PATCH for 8.1] intel_iommu: refine iotlb hash calculation

2023-04-13 Thread Alex Bennée
Peter Maydell writes: > On Wed, 12 Apr 2023 at 09:40, Alex Bennée wrote: >> Peter Maydell writes: >> > Whoops, hadn't noticed that guint type... (glib's >> > g_int64_hash()'s approach to this is to XOR the top >> > 32 bits with the bottom 32 bits to produce the 32-bit >> > hash value.) >> >>

Re: [PATCH for 8.1] intel_iommu: refine iotlb hash calculation

2023-04-12 Thread Peter Maydell
On Wed, 12 Apr 2023 at 09:40, Alex Bennée wrote: > Peter Maydell writes: > > Whoops, hadn't noticed that guint type... (glib's > > g_int64_hash()'s approach to this is to XOR the top > > 32 bits with the bottom 32 bits to produce the 32-bit > > hash value.) > > This is less of a hash and more jus

Re: [PATCH for 8.1] intel_iommu: refine iotlb hash calculation

2023-04-12 Thread Alex Bennée
Peter Maydell writes: > On Tue, 11 Apr 2023 at 15:14, Peter Xu wrote: >> >> On Mon, Apr 10, 2023 at 11:32:08AM +0800, Jason Wang wrote: >> > @@ -222,9 +222,9 @@ static guint vtd_iotlb_hash(gconstpointer v) >> > { >> > const struct vtd_iotlb_key *key = v; >> > >> > -return key->gfn |

Re: [PATCH for 8.1] intel_iommu: refine iotlb hash calculation

2023-04-11 Thread Jason Wang
On Tue, Apr 11, 2023 at 10:44 PM Peter Xu wrote: > > On Tue, Apr 11, 2023 at 03:30:08PM +0100, Peter Maydell wrote: > > On Tue, 11 Apr 2023 at 15:14, Peter Xu wrote: > > > > > > On Mon, Apr 10, 2023 at 11:32:08AM +0800, Jason Wang wrote: > > > > @@ -222,9 +222,9 @@ static guint vtd_iotlb_hash(gco

Re: [PATCH for 8.1] intel_iommu: refine iotlb hash calculation

2023-04-11 Thread Peter Xu
On Tue, Apr 11, 2023 at 03:30:08PM +0100, Peter Maydell wrote: > On Tue, 11 Apr 2023 at 15:14, Peter Xu wrote: > > > > On Mon, Apr 10, 2023 at 11:32:08AM +0800, Jason Wang wrote: > > > @@ -222,9 +222,9 @@ static guint vtd_iotlb_hash(gconstpointer v) > > > { > > > const struct vtd_iotlb_key *

Re: [PATCH for 8.1] intel_iommu: refine iotlb hash calculation

2023-04-11 Thread Peter Maydell
On Tue, 11 Apr 2023 at 15:14, Peter Xu wrote: > > On Mon, Apr 10, 2023 at 11:32:08AM +0800, Jason Wang wrote: > > @@ -222,9 +222,9 @@ static guint vtd_iotlb_hash(gconstpointer v) > > { > > const struct vtd_iotlb_key *key = v; > > > > -return key->gfn | ((key->sid) << VTD_IOTLB_SID_SHIFT)

Re: [PATCH for 8.1] intel_iommu: refine iotlb hash calculation

2023-04-11 Thread Peter Xu
On Mon, Apr 10, 2023 at 11:32:08AM +0800, Jason Wang wrote: > Commit 1b2b12376c8 ("intel-iommu: PASID support") takes PASID into > account when calculating iotlb hash like: > > static guint vtd_iotlb_hash(gconstpointer v) > { > const struct vtd_iotlb_key *key = v; > > return key->gfn | ((

Re: [PATCH for 8.1] intel_iommu: refine iotlb hash calculation

2023-04-11 Thread Peter Maydell
On Mon, 10 Apr 2023 at 04:32, Jason Wang wrote: > > Commit 1b2b12376c8 ("intel-iommu: PASID support") takes PASID into > account when calculating iotlb hash like: > > static guint vtd_iotlb_hash(gconstpointer v) > { > const struct vtd_iotlb_key *key = v; > > return key->gfn | ((key->sid) <

[PATCH for 8.1] intel_iommu: refine iotlb hash calculation

2023-04-09 Thread Jason Wang
Commit 1b2b12376c8 ("intel-iommu: PASID support") takes PASID into account when calculating iotlb hash like: static guint vtd_iotlb_hash(gconstpointer v) { const struct vtd_iotlb_key *key = v; return key->gfn | ((key->sid) << VTD_IOTLB_SID_SHIFT) | (key->level) << VTD_IOTLB_LVL