Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
b7b0256
Revert "NVIDIA: SAUCE: PCI/MSI: Enable memory decoding before restori…
ltrager Sep 1, 2026
1b61958
Revert "NVIDIA: SAUCE: arm_mpam: Apply T241-MPAM-6 to 63-bit counters"
ltrager Aug 7, 2026
f40b9a8
Revert "NVIDIA: SAUCE: Fix mbm_L3_assign and mon_local_bytes"
ltrager Aug 7, 2026
bd1954e
Revert "NVIDIA: VR: SAUCE: resctrl: add MBA max_lim sysfs and visibil…
ltrager Aug 7, 2026
96e7092
Revert "NVIDIA: VR: SAUCE: resctrl/mpam: probe MPAMF_MBW_IDR MAX_LIM …
ltrager Aug 7, 2026
5bd6f5b
Revert "NVIDIA: SAUCE: resctrl/mpam: reset RIS by applying explicit d…
ltrager Aug 7, 2026
61f08b9
Revert "NVIDIA: SAUCE: arm_mpam: Include all associated MSC component…
ltrager Aug 7, 2026
bc011e5
Revert "NVIDIA: VR: SAUCE: arm_mpam: Avoid MSC teardown for the SW pr…
ltrager Aug 7, 2026
f9761a5
Revert "NVIDIA: SAUCE: arm_mpam: resctrl: Determine if any exposed co…
ltrager Aug 7, 2026
2604f45
Revert "NVIDIA: VR: SAUCE: fs/resctrl: Add support for assigning iomm…
ltrager Aug 7, 2026
28a2c02
Revert "NVIDIA: VR: SAUCE: iommu: Add helpers to get and set the QoS …
ltrager Aug 7, 2026
9bc7ea2
Revert "NVIDIA: VR: SAUCE: iommu/arm-smmu-v3: Add mpam helpers to que…
ltrager Aug 7, 2026
bfcd3f8
Revert "NVIDIA: VR: SAUCE: iommu/arm-smmu-v3: Register SMMU capabilit…
ltrager Aug 7, 2026
d7d0bff
Revert "NVIDIA: VR: SAUCE: fs/resctrl: Add this_is_not_abi mount option"
ltrager Aug 7, 2026
fd499ed
Revert "NVIDIA: VR: SAUCE: arm_mpam: Allow MSC to be forced to have a…
ltrager Aug 7, 2026
804e76b
Revert "NVIDIA: VR: SAUCE: arm_mpam: Allow the maximum partid to be o…
ltrager Aug 7, 2026
5687093
Revert "NVIDIA: VR: SAUCE: arm_mpam: Split the locking around the mon…
ltrager Aug 7, 2026
93b5824
Revert "NVIDIA: VR: SAUCE: arm_mpam: Expose the number of NRDY retrie…
ltrager Aug 7, 2026
662bb49
Revert "NVIDIA: VR: SAUCE: arm_mpam: Add debugfs entries to show the …
ltrager Aug 7, 2026
e872eb5
Revert "NVIDIA: VR: SAUCE: fs/resctrl: Avoid a race with dom_data_exi…
ltrager Aug 7, 2026
01eec3c
Revert "NVIDIA: SAUCE: arm_mpam: resctrl: Add resctrl_arch_cntr_read(…
ltrager Aug 7, 2026
b6d1315
Revert "NVIDIA: SAUCE: arm_mpam: resctrl: Add resctrl_arch_rmid_read(…
ltrager Aug 7, 2026
8bfa6ef
Revert "NVIDIA: SAUCE: arm_mpam: resctrl: Add resctrl_arch_config_cnt…
ltrager Aug 7, 2026
a096b2a
Revert "NVIDIA: VR: SAUCE: arm_mpam: resctrl: Add kunit test for ABMC…
ltrager Aug 7, 2026
33c8444
Revert "NVIDIA: SAUCE: arm_mpam: resctrl: Pre-allocate assignable mon…
ltrager Aug 7, 2026
d86ca40
Revert "NVIDIA: SAUCE: arm_mpam: resctrl: Pre-allocate free running m…
ltrager Aug 7, 2026
a6f40d2
Revert "NVIDIA: SAUCE: untested: arm_mpam: resctrl: pick classes for …
ltrager Aug 7, 2026
873912d
PCI: Introduce PCI_SLOT_PLACEHOLDER constant for slot_nr placeholder …
Aug 5, 2026
f2d7fc8
PCI: Allow per function PCI slots to fix slot reset on s390
Aug 5, 2026
c7d80f7
PCI: Avoid saving config space state if inaccessible
Aug 5, 2026
9a746be
PCI: Fail FLR when config space is inaccessible
Aug 5, 2026
5b3608f
PCI/MSI: Enable memory decoding before restoring MSI-X messages
Aug 5, 2026
d461c80
KVM: arm64: Force guest EL1 to use user-space's partid configuration
Mar 13, 2026
8aa034e
arm_mpam: Update architecture version check for MPAM MSC
henryZe May 8, 2026
327caad
NVIDIA: SAUCE: arm_mpam: let low level MSC accessors return an error
Andre-ARM Aug 7, 2026
297f385
NVIDIA: SAUCE: resctrl/mpam: probe MPAMF_MBW_IDR MAX_LIM and hardlim_rw
fyu1 Apr 6, 2026
56c93a9
NVIDIA: SAUCE: arm_mpam: propagate MSC access errors for hw_probe fun…
Andre-ARM Aug 7, 2026
907a57a
NVIDIA: SAUCE: arm_mpam: propagate MSC access errors for MBWU counters
Andre-ARM Aug 7, 2026
0713150
NVIDIA: SAUCE: arm_mpam: propagate MSC access errors for msmon helpers
Andre-ARM Aug 7, 2026
177f691
NVIDIA: SAUCE: arm_mpam: propagate MSC access errors for __ris_msmon_…
Andre-ARM Aug 7, 2026
08e1cb3
NVIDIA: SAUCE: arm_mpam: propagate MSC access errors for state saving…
Andre-ARM Aug 7, 2026
96c5c51
NVIDIA: SAUCE: resctrl/mpam: reset RIS by applying explicit default c…
shankerd04 Mar 4, 2026
685d533
arm_mpam: Fix MPAMCFG_MBW_PBM register setting
fyu1 Jun 7, 2026
77d0ad3
NVIDIA: SAUCE: arm_mpam: propagate MSC access errors for mpam_reprogr…
Andre-ARM Aug 7, 2026
ed56cd7
NVIDIA: SAUCE: arm_mpam: propagate MSC access errors for interrupt co…
Andre-ARM Aug 7, 2026
bd39639
NVIDIA: SAUCE: arm_mpam: prepare mon_sel locking for MPAM-Fb
Andre-ARM Aug 7, 2026
0b48c7c
NVIDIA: SAUCE: arm_mpam: add MPAM-Fb MSC firmware access support
Andre-ARM Aug 7, 2026
600430a
NVIDIA: SAUCE: arm_mpam: Avoid MSC teardown for the SW programming er…
shankerd04 Nov 24, 2025
00d1d8a
NVIDIA: SAUCE: arm_mpam: change MPAM-Fb error IRQ to use a threaded I…
Andre-ARM Aug 7, 2026
54eeb89
NVIDIA: SAUCE: arm_mpam: detect and enable MPAM-Fb PCC support
Andre-ARM Aug 7, 2026
9aaf440
fs/resctrl: Tidy up the error path in resctrl_mkdir_event_configs()
benhor01 May 6, 2026
bfdc2da
x86,fs/resctrl: Create 'event_filter' files read only if they're not …
benhor01 May 6, 2026
89e5cca
fs/resctrl: Disallow the software controller when MBM counters are as…
benhor01 May 6, 2026
a007316
fs/resctrl: Add monitor property 'mbm_cntr_assign_fixed'
benhor01 May 6, 2026
749ed1c
fs/resctrl: Continue counter allocation after failure
benhor01 May 6, 2026
e997f96
fs/resctrl: Document that automatic counter assignment is best effort
benhor01 May 6, 2026
2485711
fs/resctrl: Document tasks file behaviour for task id 0 and idle tasks
benhor01 May 6, 2026
82d9158
arm_mpam: resctrl: Pick classes for use as MBM counters
Jul 31, 2026
2d6022c
arm_mpam: resctrl: Pre-allocate assignable monitors
benhor01 Jul 31, 2026
7e94f2d
arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use
Jul 31, 2026
8be70bc
arm_mpam: resctrl: Add resctrl_arch_cntr_read() & resctrl_arch_reset_…
Jul 31, 2026
3c28eeb
arm64: mpam: Add memory bandwidth usage (MBWU) documentation
benhor01 Jul 31, 2026
9924602
NVIDIA: SAUCE: arm_mpam: resctrl: Add kunit test for ABMC/CDP interac…
Oct 16, 2025
b533453
NVIDIA: SAUCE: fs/resctrl: Avoid a race with dom_data_exit() and rmid…
Jun 10, 2024
c3c2f68
NVIDIA: SAUCE: arm_mpam: Allow the maximum partid to be overridden fr…
Oct 29, 2021
7852bb1
NVIDIA: SAUCE: fs/resctrl: Add this_is_not_abi mount option
Sep 15, 2022
41cfaf7
NVIDIA: SAUCE: arm_mpam: Allow MSC to be forced to have an unknown lo…
Jul 1, 2025
ef8e624
NVIDIA: SAUCE: iommu/arm-smmu-v3: Register SMMU capabilities with MPAM
Sep 17, 2021
fa399d1
NVIDIA: SAUCE: iommu/arm-smmu-v3: Add mpam helpers to query and set s…
Sep 14, 2021
a033786
NVIDIA: SAUCE: iommu: Add helpers to get and set the QoS state
Jul 31, 2023
3ac007a
NVIDIA: SAUCE: fs/resctrl: Add support for assigning iommu_groups to …
Sep 16, 2021
c7160da
NVIDIA: SAUCE: arm_mpam: Add debugfs entries to show the MSC/RIS the …
Sep 1, 2021
7fb251c
NVIDIA: SAUCE: arm_mpam: Expose the number of NRDY retries in debugfs
Jul 18, 2025
615e83f
NVIDIA: SAUCE: arm_mpam: resctrl: Determine if any exposed counter ca…
Mar 15, 2024
8b74e3e
NVIDIA: SAUCE: resctrl: add MBA max_lim sysfs and visibility from init
fyu1 Apr 6, 2026
4f948a1
NVIDIA: SAUCE: arm_mpam: Include all MSC components during domain setup
fyu1 Jun 2, 2026
9394770
NVIDIA: SAUCE: Fix mbm_L3_assign and mon_local_bytes
fyu1 May 13, 2026
2afbc1b
NVIDIA: SAUCE: arm_mpam: Fix monitor capability and MBM assign for MB…
fyu1 Jun 21, 2026
c038f48
NVIDIA: SAUCE: fs/resctrl: Fix incorrect PID parsing after IOMMU grou…
henryZe Apr 14, 2026
bc1df06
NVIDIA: SAUCE: fs/resctrl: Remove unused 'of' parameter from rdtgroup…
henryZe Apr 14, 2026
3bdc5d9
NVIDIA: SAUCE: fs/resctrl: Migrate IOMMU groups when removing resourc…
henryZe Apr 14, 2026
70690b5
NVIDIA: SAUCE: fs/resctrl: Fix redefinition of iommu helpers with CON…
ltrager Jul 13, 2026
2d685c1
NVIDIA: SAUCE: arm_mpam: Ensure MBWU counters are reset on restore
benhor01 Jul 10, 2026
107ab4f
NVIDIA: SAUCE: fs/resctrl: Fix iommu_group reference leaks when itera…
ltrager Jul 15, 2026
290e5b6
NVIDIA: SAUCE: arm_mpam: Use __ris_msmon_read() for saving MBWU state
benhor01 Jul 10, 2026
baeb83c
arm_mpam: Apply T241-MPAM-6 to 63-bit counters
shankerd04 Jul 31, 2026
bf9a8df
NVIDIA: SAUCE: arm_mpam: Initialize all of struct mon_read in mpam_re…
benhor01 Jul 10, 2026
7c9e4b8
NVIDIA: SAUCE: arm_mpam: resctrl: Correct check that existing class i…
benhor01 Jul 10, 2026
7700016
NVIDIA: SAUCE: arm_mpam: Fix PCC channel lifetime during MSC removal
ltrager Aug 4, 2026
778141d
NVIDIA: SAUCE: arm_mpam: Quiesce error IRQ before MSC removal
ltrager Sep 1, 2026
c6f7a1c
NVIDIA: SAUCE: fs/resctrl: Continue IOMMU group migration after errors
ltrager Sep 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Documentation/arch/arm64/mpam.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,28 @@ The supported features are:
there is at least one CSU monitor on each MSC that makes up the L3 group.
Exposing CSU counters from other caches or devices is not supported.

* Memory Bandwidth Usage (MBWU) on or after the L3 cache. resctrl uses the
L3 cache-id to identify where the memory bandwidth is measured. For this
reason the platform must have an L3 cache with cache-id's supplied by
firmware. (The platform doesn't need to support MPAM.)

Memory bandwidth monitoring makes use of MBWU monitors in each MSC that
makes up the L3 group. If the memory bandwidth monitoring is on the memory
rather than the L3 then there must be a single global L3 as otherwise it
is unknown which L3 the traffic came from.

To expose 'mbm_total_bytes', the topology of the group of MSC chosen must
match the topology of the L3 cache so that the cache-id's can be
repainted. For example: Platforms with Memory bandwidth monitors on
CPU-less NUMA nodes cannot expose 'mbm_total_bytes' as these nodes do not
have a corresponding L3 cache. 'mbm_local_bytes' is not exposed as MPAM
cannot distinguish local traffic from global traffic.

All these restrictions based on L3 cache are due to resctrl, currently, only
supporting monitoring at the L3 scope. It is expected that going forward more
MBWU monitors can be exposed to the user after support for more monitoring
scopes is added to resctrl.

Reporting Bugs
==============
If you are not seeing the counters or controls you expect please share the
Expand Down
22 changes: 16 additions & 6 deletions Documentation/filesystems/resctrl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,9 @@ with the following files:

Two MBM events are supported by default: mbm_local_bytes and mbm_total_bytes.
Each MBM event's sub-directory contains a file named "event_filter" that is
used to view and modify which memory transactions the MBM event is configured
with. The file is accessible only when "mbm_event" counter assignment mode is
enabled.
used to view and (if writable) modify which memory transactions the MBM event
is configured with. The file is accessible only when "mbm_event" counter
assignment mode is enabled.

List of memory transaction types supported:

Expand All @@ -466,9 +466,8 @@ with the following files:
# cat /sys/fs/resctrl/info/L3_MON/event_configs/mbm_local_bytes/event_filter
local_reads,local_non_temporal_writes,local_reads_slow_memory

Modify the event configuration by writing to the "event_filter" file within
the "event_configs" directory. The read/write "event_filter" file contains the
configuration of the event that reflects which memory transactions are counted by it.
The memory transactions the MBM event is configured with can be changed
if "event_filter" is writable.

For example::

Expand All @@ -492,6 +491,12 @@ with the following files:
"1":
Auto assignment is enabled.

Automatic counter assignment is done with best effort. If auto
assignment is enabled but there are not enough available counters then
monitor group creation could succeed while one or more events belonging
to the group may not have a counter assigned in all domains. Consult
mbm_L3_assignments for counter assignment states of the new groups.

Example::

# echo 0 > /sys/fs/resctrl/info/L3_MON/mbm_assign_on_mkdir
Expand Down Expand Up @@ -582,6 +587,11 @@ All groups contain the following files:
then the task must already belong to the CTRL_MON parent of this
group. The task is removed from any previous MON group.

When writing to this file, a task id of 0 is interpreted as the
task id of the currently running task. On reading the file, a task
id of 0 will never be shown and there is no representation of the
idle tasks. Instead, a CPU's idle task is always considered as a
member of the group owning the CPU.

"cpus":
Reading this file shows a bitmask of the logical CPUs owned by
Expand Down
16 changes: 16 additions & 0 deletions arch/arm64/kvm/hyp/vhe/sysreg-sr.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,21 @@ void sysreg_restore_guest_state_vhe(struct kvm_cpu_context *ctxt)
}
NOKPROBE_SYMBOL(sysreg_restore_guest_state_vhe);

/*
* The _EL0 value was written by the host's context switch and belongs to the
* VMM. Copy this into the guest's _EL1 register.
*/
static inline void __mpam_guest_load(void)
{
u64 mask = MPAM0_EL1_PARTID_D | MPAM0_EL1_PARTID_I | MPAM0_EL1_PMG_D | MPAM0_EL1_PMG_I;

if (system_supports_mpam()) {
u64 val = (read_sysreg_s(SYS_MPAM0_EL1) & mask) | MPAM1_EL1_MPAMEN;

write_sysreg_el1(val, SYS_MPAM1);
}
}

/**
* __vcpu_load_switch_sysregs - Load guest system registers to the physical CPU
*
Expand Down Expand Up @@ -222,6 +237,7 @@ void __vcpu_load_switch_sysregs(struct kvm_vcpu *vcpu)
*/
__sysreg32_restore_state(vcpu);
__sysreg_restore_user_state(guest_ctxt);
__mpam_guest_load();

if (unlikely(is_hyp_ctxt(vcpu))) {
__sysreg_restore_vel2_state(vcpu);
Expand Down
1 change: 1 addition & 0 deletions arch/x86/kernel/cpu/resctrl/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ int __init rdt_get_l3_mon_config(struct rdt_resource *r)
(rdt_cpu_has(X86_FEATURE_CQM_MBM_TOTAL) ||
rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL))) {
r->mon.mbm_cntr_assignable = true;
r->mon.mbm_cntr_configurable = true;
cpuid_count(0x80000020, 5, &eax, &ebx, &ecx, &edx);
r->mon.num_mbm_cntrs = (ebx & GENMASK(15, 0)) + 1;
hw_res->mbm_cntr_assign_enabled = true;
Expand Down
91 changes: 3 additions & 88 deletions drivers/acpi/arm64/mpam.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,51 +95,17 @@ static void acpi_mpam_parse_irqs(struct platform_device *pdev,
res[(*res_idx)++] = DEFINE_RES_IRQ_NAMED(irq, "error");
}

#define UUID_MPAM_INTERCONNECT_TABLE "fe2bd645-033b-49e6-9479-2e0b8b21d1cd"

struct acpi_mpam_interconnect_descriptor_table {
u8 type_uuid[16];
u32 num_descriptors;
};

struct acpi_mpam_interconnect_descriptor {
u32 source_id;
u32 destination_id;
u8 link_type;
u8 reserved[3];
};

static int acpi_mpam_parse_resource(struct acpi_mpam_msc_node *tbl_msc,
struct mpam_msc *msc,
static int acpi_mpam_parse_resource(struct mpam_msc *msc,
struct acpi_mpam_resource_node *res)
{
struct acpi_mpam_interconnect_descriptor_table *tbl_int_tbl;
struct acpi_mpam_interconnect_descriptor *tbl_int;
guid_t int_tbl_uuid, spec_uuid;
int level, nid;
u32 cache_id;
off_t offset;

/*
* Class IDs are somewhat arbitrary, but need to be co-ordinated.
* 0-N are caches,
* 64, 65: Interconnect, but ideally these would appear between the
* classes the controls are adjacent to.
* 128: SMMU,
* 192-192+level: Memory Side Caches, nothing checks that N is a
* small number.
* 255: Memory Controllers
*
* ACPI devices would need a class id allocated based on the _HID.
*
* Classes that the mpam driver can't currently plumb into resctrl
* are registered as UNKNOWN.
*/
switch (res->locator_type) {
case ACPI_MPAM_LOCATION_TYPE_PROCESSOR_CACHE:
cache_id = res->locator.cache_locator.cache_reference;
level = find_acpi_cache_level_from_id(cache_id);
if (level <= 0 || level >= 64) {
if (level <= 0) {
pr_err_once("Bad level (%d) for cache with id %u\n", level, cache_id);
return -EINVAL;
}
Expand All @@ -154,57 +120,6 @@ static int acpi_mpam_parse_resource(struct acpi_mpam_msc_node *tbl_msc,
}
return mpam_ris_create(msc, res->ris_index, MPAM_CLASS_MEMORY,
MPAM_CLASS_ID_DEFAULT, nid);
case ACPI_MPAM_LOCATION_TYPE_SMMU:
return mpam_ris_create(msc, res->ris_index, MPAM_CLASS_UNKNOWN,
128, res->locator.smmu_locator.smmu_interface);
case ACPI_MPAM_LOCATION_TYPE_MEMORY_CACHE:
cache_id = res->locator.mem_cache_locator.reference;
level = res->locator.mem_cache_locator.level;
if (192 + level >= 255) {
pr_err_once("Bad level (%u) for memory side cache with reference %u\n",
level, cache_id);
return -EINVAL;
}

return mpam_ris_create(msc, res->ris_index, MPAM_CLASS_CACHE,
192 + level, cache_id);

case ACPI_MPAM_LOCATION_TYPE_INTERCONNECT:
/* Find the descriptor table, and check it lands in the parent msc */
offset = res->locator.interconnect_ifc_locator.inter_connect_desc_tbl_off;
if (offset >= tbl_msc->length) {
pr_err_once("Bad offset (%lu) for interconnect descriptor on msc %u\n",
offset, tbl_msc->identifier);
return -EINVAL;
}
tbl_int_tbl = ACPI_ADD_PTR(struct acpi_mpam_interconnect_descriptor_table,
tbl_msc, offset);
guid_parse(UUID_MPAM_INTERCONNECT_TABLE, &spec_uuid);
import_guid(&int_tbl_uuid, tbl_int_tbl->type_uuid);
if (!guid_equal(&spec_uuid, &int_tbl_uuid)) {
pr_err_once("Bad UUID for interconnect descriptor on msc %u\n",
tbl_msc->identifier);
return -EINVAL;
}

offset += sizeof(*tbl_int_tbl);
offset += tbl_int_tbl->num_descriptors * sizeof(*tbl_int);
if (offset >= tbl_msc->length) {
pr_err_once("Bad num_descriptors (%u) for interconnect descriptor on msc %u\n",
tbl_int_tbl->num_descriptors, tbl_msc->identifier);
return -EINVAL;
}

tbl_int = ACPI_ADD_PTR(struct acpi_mpam_interconnect_descriptor,
tbl_int_tbl, sizeof(*tbl_int_tbl));
cache_id = tbl_int->source_id;

/* Unknown link type? */
if (tbl_int->link_type != 0 && tbl_int->link_type == 1)
return 0;

return mpam_ris_create(msc, res->ris_index, MPAM_CLASS_UNKNOWN,
64 + tbl_int->link_type, cache_id);
default:
/* These get discovered later and are treated as unknown */
return 0;
Expand Down Expand Up @@ -235,7 +150,7 @@ int acpi_mpam_parse_resources(struct mpam_msc *msc,
return -EINVAL;
}

err = acpi_mpam_parse_resource(tbl_msc, msc, resource);
err = acpi_mpam_parse_resource(msc, resource);
if (err)
return err;

Expand Down
12 changes: 6 additions & 6 deletions drivers/iommu/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2184,12 +2184,6 @@ void iommu_domain_free(struct iommu_domain *domain)
}
EXPORT_SYMBOL_GPL(iommu_domain_free);

struct iommu_domain *iommu_get_domain_for_group(struct iommu_group *group)
{
return group->domain;
}
EXPORT_SYMBOL_GPL(iommu_get_domain_for_group);

/*
* Put the group's domain back to the appropriate core-owned domain - either the
* standard kernel-mode DMA configuration or an all-DMA-blocked domain.
Expand Down Expand Up @@ -2365,6 +2359,12 @@ struct iommu_domain *iommu_driver_get_domain_for_dev(struct device *dev)
}
EXPORT_SYMBOL_GPL(iommu_driver_get_domain_for_dev);

struct iommu_domain *iommu_get_domain_for_group(struct iommu_group *group)
{
return group->domain;
}
EXPORT_SYMBOL_GPL(iommu_get_domain_for_group);

/*
* For IOMMU_DOMAIN_DMA implementations which already provide their own
* guarantees that the group and its default domain are valid and correct.
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/hotplug/pnv_php.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ static struct pnv_php_slot *pnv_php_alloc_slot(struct device_node *dn)
if (dn->child && PCI_DN(dn->child))
php_slot->slot_no = PCI_SLOT(PCI_DN(dn->child)->devfn);
else
php_slot->slot_no = -1; /* Placeholder slot */
php_slot->slot_no = PCI_SLOT_PLACEHOLDER; /* Placeholder slot */

kref_init(&php_slot->kref);
php_slot->state = PNV_PHP_STATE_INITIALIZED;
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/hotplug/rpaphp_slot.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int rpaphp_register_slot(struct slot *slot)
struct device_node *child;
u32 my_index;
int retval;
int slotno = -1;
int slotno = PCI_SLOT_PLACEHOLDER;

dbg("%s registering slot:path[%pOF] index[%x], name[%s] pdomain[%x] type[%d]\n",
__func__, slot->dn, slot->index, slot->name,
Expand Down
6 changes: 6 additions & 0 deletions drivers/pci/msi/msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,12 @@ void __pci_restore_msix_state(struct pci_dev *dev)
pci_intx_for_msi(dev, 0);
pci_msix_clear_and_set_ctrl(dev, 0,
PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL);

/*
* The restored device state may not have Memory Space enabled.
* Since the MSI-X Table and PBA are in Memory Space, enable it
* while restoring them.
*/
pci_read_config_word(dev, PCI_COMMAND, &cmd);
pci_write_config_word(dev, PCI_COMMAND, cmd | PCI_COMMAND_MEMORY);

Expand Down
33 changes: 31 additions & 2 deletions drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,28 @@ u16 pci_find_dvsec_capability(struct pci_dev *dev, u16 vendor, u16 dvsec)
}
EXPORT_SYMBOL_GPL(pci_find_dvsec_capability);

static bool pci_dev_config_accessible(struct pci_dev *dev, char *msg)
{
u32 val;

/*
* If a device's config space is inaccessible, reads typically
* return ~0. Since Device and Vendor ID are always ~0 for VFs,
* check the Command and Status registers instead.
*
* N.B. This is racy because the device may become inaccessible
* before the next access.
*/
pci_read_config_dword(dev, PCI_COMMAND, &val);
if (PCI_POSSIBLE_ERROR(val)) {
pci_warn(dev, "Device config space inaccessible; unable to %s\n",
msg);
return false;
}

return true;
}

/**
* pci_find_parent_resource - return resource region of parent bus of given
* region
Expand Down Expand Up @@ -4333,6 +4355,9 @@ int pcie_flr(struct pci_dev *dev)
{
int ret;

if (!pci_dev_config_accessible(dev, "FLR"))
return -ENOTTY;

if (!pci_wait_for_pending_transaction(dev))
pci_err(dev, "timed out waiting for pending transaction; performing function level reset anyway\n");

Expand Down Expand Up @@ -4867,8 +4892,9 @@ static int pci_reset_hotplug_slot(struct hotplug_slot *hotplug, bool probe)

static int pci_dev_reset_slot_function(struct pci_dev *dev, bool probe)
{
if (dev->multifunction || dev->subordinate || !dev->slot ||
dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET)
if (dev->subordinate || !dev->slot ||
dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET ||
(dev->multifunction && !dev->slot->per_func_slot))
return -ENOTTY;

return pci_reset_hotplug_slot(dev->slot->hotplug, probe);
Expand Down Expand Up @@ -5031,6 +5057,9 @@ static void pci_dev_save_and_disable(struct pci_dev *dev)
*/
pci_set_power_state(dev, PCI_D0);

if (!pci_dev_config_accessible(dev, "save state"))
return;

pci_save_state(dev);
/*
* Disable the device by clearing the Command register, except for
Expand Down
Loading
Loading