]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/apic: Drop apic::delivery_mode
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 2 Nov 2023 12:26:19 +0000 (12:26 +0000)
committerBorislav Petkov (AMD) <bp@alien8.de>
Tue, 21 Nov 2023 15:58:54 +0000 (16:58 +0100)
This field is set to APIC_DELIVERY_MODE_FIXED in all cases, and is read
exactly once.  Fold the constant in uv_program_mmr() and drop the field.

Searching for the origin of the stale HyperV comment reveals commit
a31e58e129f7 ("x86/apic: Switch all APICs to Fixed delivery mode") which
notes:

  As a consequence of this change, the apic::irq_delivery_mode field is
  now pointless, but this needs to be cleaned up in a separate patch.

6 years is long enough for this technical debt to have survived.

  [ bp: Fold in
    https://lore.kernel.org/r/20231121123034.1442059-1-andrew.cooper3@citrix.com
  ]

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
Link: https://lore.kernel.org/r/20231102-x86-apic-v1-1-bf049a2a0ed6@citrix.com
13 files changed:
arch/x86/include/asm/apic.h
arch/x86/kernel/apic/apic_flat_64.c
arch/x86/kernel/apic/apic_noop.c
arch/x86/kernel/apic/apic_numachip.c
arch/x86/kernel/apic/bigsmp_32.c
arch/x86/kernel/apic/probe_32.c
arch/x86/kernel/apic/x2apic_cluster.c
arch/x86/kernel/apic/x2apic_phys.c
arch/x86/kernel/apic/x2apic_uv_x.c
arch/x86/platform/uv/uv_irq.c
drivers/iommu/amd/iommu.c
drivers/iommu/intel/irq_remapping.c
drivers/pci/controller/pci-hyperv.c

index d21f48f1c242e06ba9139be346f1af40d4c1084d..9d159b771dc814a123e77f85ca0793891d16a04d 100644 (file)
@@ -272,8 +272,6 @@ struct apic {
        void    (*send_IPI_all)(int vector);
        void    (*send_IPI_self)(int vector);
 
-       enum apic_delivery_modes delivery_mode;
-
        u32     disable_esr             : 1,
                dest_mode_logical       : 1,
                x2apic_set_max_apicid   : 1,
index 7139867d69cd2d1acce95a1cec45ebe04c01ed4e..b295a056a4fc5c026a4caa4edfccba7835721837 100644 (file)
@@ -82,7 +82,6 @@ static struct apic apic_flat __ro_after_init = {
        .acpi_madt_oem_check            = flat_acpi_madt_oem_check,
        .apic_id_registered             = default_apic_id_registered,
 
-       .delivery_mode                  = APIC_DELIVERY_MODE_FIXED,
        .dest_mode_logical              = true,
 
        .disable_esr                    = 0,
@@ -154,7 +153,6 @@ static struct apic apic_physflat __ro_after_init = {
        .acpi_madt_oem_check            = physflat_acpi_madt_oem_check,
        .apic_id_registered             = default_apic_id_registered,
 
-       .delivery_mode                  = APIC_DELIVERY_MODE_FIXED,
        .dest_mode_logical              = false,
 
        .disable_esr                    = 0,
index b00d52ae84fa95ae3dd77816eb1c243bac1b3557..9f1d553eb48f48eeea15c7eb4460b4d327ecb826 100644 (file)
@@ -47,7 +47,6 @@ static void noop_apic_write(u32 reg, u32 val)
 struct apic apic_noop __ro_after_init = {
        .name                           = "noop",
 
-       .delivery_mode                  = APIC_DELIVERY_MODE_FIXED,
        .dest_mode_logical              = true,
 
        .disable_esr                    = 0,
index 456a14c44f67abcc8fba1f71dc9d5c3bc181ce53..7d0c51b9d3bca8c29c44e2cb7694243b7bb6a678 100644 (file)
@@ -222,7 +222,6 @@ static const struct apic apic_numachip1 __refconst = {
        .probe                          = numachip1_probe,
        .acpi_madt_oem_check            = numachip1_acpi_madt_oem_check,
 
-       .delivery_mode                  = APIC_DELIVERY_MODE_FIXED,
        .dest_mode_logical              = false,
 
        .disable_esr                    = 0,
@@ -259,7 +258,6 @@ static const struct apic apic_numachip2 __refconst = {
        .probe                          = numachip2_probe,
        .acpi_madt_oem_check            = numachip2_acpi_madt_oem_check,
 
-       .delivery_mode                  = APIC_DELIVERY_MODE_FIXED,
        .dest_mode_logical              = false,
 
        .disable_esr                    = 0,
index 7ee3c486cb3365c07b69e2a1bb739b5249bfd44a..5a0d60b38e6bf098e0546c4b3dcf94011452bceb 100644 (file)
@@ -80,7 +80,6 @@ static struct apic apic_bigsmp __ro_after_init = {
        .name                           = "bigsmp",
        .probe                          = probe_bigsmp,
 
-       .delivery_mode                  = APIC_DELIVERY_MODE_FIXED,
        .dest_mode_logical              = false,
 
        .disable_esr                    = 1,
index 5eb3fbe472da9d3f5b80f9cc5c0c534e15215859..c0f78059f06acac05b67c3d619134b768fd9c3b3 100644 (file)
@@ -45,7 +45,6 @@ static struct apic apic_default __ro_after_init = {
        .probe                          = probe_default,
        .apic_id_registered             = default_apic_id_registered,
 
-       .delivery_mode                  = APIC_DELIVERY_MODE_FIXED,
        .dest_mode_logical              = true,
 
        .disable_esr                    = 0,
index a8306089c91bca12277b904e1b79ad38f1b85122..28a7d3f2312d21fc864ee67cd22b86a61983d649 100644 (file)
@@ -227,7 +227,6 @@ static struct apic apic_x2apic_cluster __ro_after_init = {
        .probe                          = x2apic_cluster_probe,
        .acpi_madt_oem_check            = x2apic_acpi_madt_oem_check,
 
-       .delivery_mode                  = APIC_DELIVERY_MODE_FIXED,
        .dest_mode_logical              = true,
 
        .disable_esr                    = 0,
index 558a4a8824f478938570413dd55672687370c39a..409815a40668281923cfccf04e93ead53301d8e8 100644 (file)
@@ -145,7 +145,6 @@ static struct apic apic_x2apic_phys __ro_after_init = {
        .probe                          = x2apic_phys_probe,
        .acpi_madt_oem_check            = x2apic_acpi_madt_oem_check,
 
-       .delivery_mode                  = APIC_DELIVERY_MODE_FIXED,
        .dest_mode_logical              = false,
 
        .disable_esr                    = 0,
index 1b0d7336a28fe9b91348303368ccf51c22b27e19..f1766b18dcd07d495be3b3b21c007b9f904a3180 100644 (file)
@@ -805,7 +805,6 @@ static struct apic apic_x2apic_uv_x __ro_after_init = {
        .probe                          = uv_probe,
        .acpi_madt_oem_check            = uv_acpi_madt_oem_check,
 
-       .delivery_mode                  = APIC_DELIVERY_MODE_FIXED,
        .dest_mode_logical              = false,
 
        .disable_esr                    = 0,
index 4221259a5870ab0757c4a33b7aa53385c73485ae..a379501b7a69ec46f30732e37920e7a4af8e3873 100644 (file)
@@ -35,7 +35,7 @@ static void uv_program_mmr(struct irq_cfg *cfg, struct uv_irq_2_mmr_pnode *info)
        mmr_value = 0;
        entry = (struct uv_IO_APIC_route_entry *)&mmr_value;
        entry->vector           = cfg->vector;
-       entry->delivery_mode    = apic->delivery_mode;
+       entry->delivery_mode    = APIC_DELIVERY_MODE_FIXED;
        entry->dest_mode        = apic->dest_mode_logical;
        entry->polarity         = 0;
        entry->trigger          = 0;
index fcc987f5d4edc3ae87335fceed57eb26d7ba9b00..b9a0523cbb0a5cf4de628db0f13128599513be0c 100644 (file)
@@ -3357,7 +3357,7 @@ static void irq_remapping_prepare_irte(struct amd_ir_data *data,
 
        data->irq_2_irte.devid = devid;
        data->irq_2_irte.index = index + sub_handle;
-       iommu->irte_ops->prepare(data->entry, apic->delivery_mode,
+       iommu->irte_ops->prepare(data->entry, APIC_DELIVERY_MODE_FIXED,
                                 apic->dest_mode_logical, irq_cfg->vector,
                                 irq_cfg->dest_apicid, devid);
 
@@ -3634,7 +3634,7 @@ int amd_iommu_deactivate_guest_mode(void *data)
 
        entry->lo.fields_remap.valid       = valid;
        entry->lo.fields_remap.dm          = apic->dest_mode_logical;
-       entry->lo.fields_remap.int_type    = apic->delivery_mode;
+       entry->lo.fields_remap.int_type    = APIC_DELIVERY_MODE_FIXED;
        entry->hi.fields.vector            = cfg->vector;
        entry->lo.fields_remap.destination =
                                APICID_TO_IRTE_DEST_LO(cfg->dest_apicid);
index 29b9e55dcf26cb69cafcb01e3f99b18f763c0d48..566297bc87ddbeb934e82e6c5df2c17c322fe145 100644 (file)
@@ -1112,7 +1112,7 @@ static void prepare_irte(struct irte *irte, int vector, unsigned int dest)
         * irq migration in the presence of interrupt-remapping.
        */
        irte->trigger_mode = 0;
-       irte->dlvry_mode = apic->delivery_mode;
+       irte->dlvry_mode = APIC_DELIVERY_MODE_FIXED;
        irte->vector = vector;
        irte->dest_id = IRTE_DEST(dest);
        irte->redir_hint = 1;
index 30c7dfeccb16f50d54508b36f255da86d9274120..1eaffff40b8d4dcdee6b8516fcfbe80034a67e72 100644 (file)
@@ -650,13 +650,6 @@ static void hv_arch_irq_unmask(struct irq_data *data)
                           PCI_FUNC(pdev->devfn);
        params->int_target.vector = hv_msi_get_int_vector(data);
 
-       /*
-        * Honoring apic->delivery_mode set to APIC_DELIVERY_MODE_FIXED by
-        * setting the HV_DEVICE_INTERRUPT_TARGET_MULTICAST flag results in a
-        * spurious interrupt storm. Not doing so does not seem to have a
-        * negative effect (yet?).
-        */
-
        if (hbus->protocol_version >= PCI_PROTOCOL_VERSION_1_2) {
                /*
                 * PCI_PROTOCOL_VERSION_1_2 supports the VP_SET version of the