Skip to content

Commit 1651602

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Will Deacon: "There's a small crop of fixes for the MPAM resctrl driver, a fix for SCS/PAC patching with the AMDGPU driver and a page-table fix for realms running with 52-bit physical addresses: - Fix DWARF parsing for SCS/PAC patching to work with very large modules (such as the amdgpu driver) - Fixes to the mpam resctrl driver - Fix broken handling of 52-bit physical addresses when sharing memory from within a realm" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: realm: Fix PTE_NS_SHARED for 52bit PA support arm_mpam: Force __iomem casts arm_mpam: Disable preemption when making accesses to fake MSC in kunit test arm_mpam: Fix null pointer dereference when restoring bandwidth counters arm64/scs: Fix handling of advance_loc4
2 parents c3d1378 + 8c6e9b6 commit 1651602

4 files changed

Lines changed: 27 additions & 8 deletions

File tree

arch/arm64/kernel/pi/patch-scs.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,14 @@ static int scs_handle_fde_frame(const struct eh_frame *frame,
192192
size -= 2;
193193
break;
194194

195+
case DW_CFA_advance_loc4:
196+
loc += *opcode++ * code_alignment_factor;
197+
loc += (*opcode++ << 8) * code_alignment_factor;
198+
loc += (*opcode++ << 16) * code_alignment_factor;
199+
loc += (*opcode++ << 24) * code_alignment_factor;
200+
size -= 4;
201+
break;
202+
195203
case DW_CFA_def_cfa:
196204
case DW_CFA_offset_extended:
197205
size = skip_xleb128(&opcode, size);

arch/arm64/kernel/rsi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <asm/io.h>
1414
#include <asm/mem_encrypt.h>
15+
#include <asm/pgtable.h>
1516
#include <asm/rsi.h>
1617

1718
static struct realm_config config;
@@ -146,7 +147,7 @@ void __init arm64_rsi_init(void)
146147
return;
147148
if (WARN_ON(rsi_get_realm_config(&config)))
148149
return;
149-
prot_ns_shared = BIT(config.ipa_bits - 1);
150+
prot_ns_shared = __phys_to_pte_val(BIT(config.ipa_bits - 1));
150151

151152
if (arm64_ioremap_prot_hook_register(realm_ioremap_hook))
152153
return;

drivers/resctrl/mpam_devices.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,6 +1428,7 @@ static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid,
14281428
static int mpam_restore_mbwu_state(void *_ris)
14291429
{
14301430
int i;
1431+
u64 val;
14311432
struct mon_read mwbu_arg;
14321433
struct mpam_msc_ris *ris = _ris;
14331434
struct mpam_class *class = ris->vmsc->comp->class;
@@ -1437,6 +1438,7 @@ static int mpam_restore_mbwu_state(void *_ris)
14371438
mwbu_arg.ris = ris;
14381439
mwbu_arg.ctx = &ris->mbwu_state[i].cfg;
14391440
mwbu_arg.type = mpam_msmon_choose_counter(class);
1441+
mwbu_arg.val = &val;
14401442

14411443
__ris_msmon_read(&mwbu_arg);
14421444
}

drivers/resctrl/test_mpam_devices.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,17 @@ static void test_mpam_enable_merge_features(struct kunit *test)
322322
mutex_unlock(&mpam_list_lock);
323323
}
324324

325+
static void __test_mpam_reset_msc_bitmap(struct mpam_msc *msc, u16 reg, u16 wd)
326+
{
327+
/* Avoid warnings when running with CONFIG_DEBUG_PREEMPT */
328+
guard(preempt)();
329+
330+
mpam_reset_msc_bitmap(msc, reg, wd);
331+
}
332+
325333
static void test_mpam_reset_msc_bitmap(struct kunit *test)
326334
{
327-
char __iomem *buf = kunit_kzalloc(test, SZ_16K, GFP_KERNEL);
335+
char __iomem *buf = (__force char __iomem *)kunit_kzalloc(test, SZ_16K, GFP_KERNEL);
328336
struct mpam_msc fake_msc = {};
329337
u32 *test_result;
330338

@@ -339,33 +347,33 @@ static void test_mpam_reset_msc_bitmap(struct kunit *test)
339347
mutex_init(&fake_msc.part_sel_lock);
340348
mutex_lock(&fake_msc.part_sel_lock);
341349

342-
test_result = (u32 *)(buf + MPAMCFG_CPBM);
350+
test_result = (__force u32 *)(buf + MPAMCFG_CPBM);
343351

344-
mpam_reset_msc_bitmap(&fake_msc, MPAMCFG_CPBM, 0);
352+
__test_mpam_reset_msc_bitmap(&fake_msc, MPAMCFG_CPBM, 0);
345353
KUNIT_EXPECT_EQ(test, test_result[0], 0);
346354
KUNIT_EXPECT_EQ(test, test_result[1], 0);
347355
test_result[0] = 0;
348356
test_result[1] = 0;
349357

350-
mpam_reset_msc_bitmap(&fake_msc, MPAMCFG_CPBM, 1);
358+
__test_mpam_reset_msc_bitmap(&fake_msc, MPAMCFG_CPBM, 1);
351359
KUNIT_EXPECT_EQ(test, test_result[0], 1);
352360
KUNIT_EXPECT_EQ(test, test_result[1], 0);
353361
test_result[0] = 0;
354362
test_result[1] = 0;
355363

356-
mpam_reset_msc_bitmap(&fake_msc, MPAMCFG_CPBM, 16);
364+
__test_mpam_reset_msc_bitmap(&fake_msc, MPAMCFG_CPBM, 16);
357365
KUNIT_EXPECT_EQ(test, test_result[0], 0xffff);
358366
KUNIT_EXPECT_EQ(test, test_result[1], 0);
359367
test_result[0] = 0;
360368
test_result[1] = 0;
361369

362-
mpam_reset_msc_bitmap(&fake_msc, MPAMCFG_CPBM, 32);
370+
__test_mpam_reset_msc_bitmap(&fake_msc, MPAMCFG_CPBM, 32);
363371
KUNIT_EXPECT_EQ(test, test_result[0], 0xffffffff);
364372
KUNIT_EXPECT_EQ(test, test_result[1], 0);
365373
test_result[0] = 0;
366374
test_result[1] = 0;
367375

368-
mpam_reset_msc_bitmap(&fake_msc, MPAMCFG_CPBM, 33);
376+
__test_mpam_reset_msc_bitmap(&fake_msc, MPAMCFG_CPBM, 33);
369377
KUNIT_EXPECT_EQ(test, test_result[0], 0xffffffff);
370378
KUNIT_EXPECT_EQ(test, test_result[1], 1);
371379
test_result[0] = 0;

0 commit comments

Comments
 (0)