mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
x86,amd_iommu: Replace cmpxchg_double()
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Mark Rutland <mark.rutland@arm.com> Tested-by: Vasant Hegde <vasant.hegde@amd.com> Tested-by: Mark Rutland <mark.rutland@arm.com> Link: https://lore.kernel.org/r/20230531132323.788955257@infradead.org
This commit is contained in:
@@ -986,8 +986,13 @@ union irte_ga_hi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct irte_ga {
|
struct irte_ga {
|
||||||
union irte_ga_lo lo;
|
union {
|
||||||
union irte_ga_hi hi;
|
struct {
|
||||||
|
union irte_ga_lo lo;
|
||||||
|
union irte_ga_hi hi;
|
||||||
|
};
|
||||||
|
u128 irte;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct irq_2_irte {
|
struct irq_2_irte {
|
||||||
|
@@ -3003,10 +3003,10 @@ out:
|
|||||||
static int modify_irte_ga(struct amd_iommu *iommu, u16 devid, int index,
|
static int modify_irte_ga(struct amd_iommu *iommu, u16 devid, int index,
|
||||||
struct irte_ga *irte, struct amd_ir_data *data)
|
struct irte_ga *irte, struct amd_ir_data *data)
|
||||||
{
|
{
|
||||||
bool ret;
|
|
||||||
struct irq_remap_table *table;
|
struct irq_remap_table *table;
|
||||||
unsigned long flags;
|
|
||||||
struct irte_ga *entry;
|
struct irte_ga *entry;
|
||||||
|
unsigned long flags;
|
||||||
|
u128 old;
|
||||||
|
|
||||||
table = get_irq_table(iommu, devid);
|
table = get_irq_table(iommu, devid);
|
||||||
if (!table)
|
if (!table)
|
||||||
@@ -3017,16 +3017,14 @@ static int modify_irte_ga(struct amd_iommu *iommu, u16 devid, int index,
|
|||||||
entry = (struct irte_ga *)table->table;
|
entry = (struct irte_ga *)table->table;
|
||||||
entry = &entry[index];
|
entry = &entry[index];
|
||||||
|
|
||||||
ret = cmpxchg_double(&entry->lo.val, &entry->hi.val,
|
|
||||||
entry->lo.val, entry->hi.val,
|
|
||||||
irte->lo.val, irte->hi.val);
|
|
||||||
/*
|
/*
|
||||||
* We use cmpxchg16 to atomically update the 128-bit IRTE,
|
* We use cmpxchg16 to atomically update the 128-bit IRTE,
|
||||||
* and it cannot be updated by the hardware or other processors
|
* and it cannot be updated by the hardware or other processors
|
||||||
* behind us, so the return value of cmpxchg16 should be the
|
* behind us, so the return value of cmpxchg16 should be the
|
||||||
* same as the old value.
|
* same as the old value.
|
||||||
*/
|
*/
|
||||||
WARN_ON(!ret);
|
old = entry->irte;
|
||||||
|
WARN_ON(!try_cmpxchg128(&entry->irte, &old, irte->irte));
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
data->ref = entry;
|
data->ref = entry;
|
||||||
|
Reference in New Issue
Block a user