mirror of
https://github.com/lemonade-sdk/mac_linuxgpu.git
synced 2026-11-22 23:57:31 -10:00
VRAM only through the kernel: no CPU access through a BAR mapping
Unplugging the GPU with the display live panicked the Mac on 239 and 240 (LLC bus error, NC write, in the dext). On 240 the panicked thread was in an atomic commit powering the display down after the agent's framebuffers were removed: dmub_srv_fb_cmd_execute, with dmub_rb_push_front having stored the command into DMUB's inbox in VRAM one byte at a time through the dext's user-space mapping of BAR0. The removal was already under way (Stop, removal_main, the aperture gate set); the error is reported only after the store has retired, so no check before a store can prevent it. Register accesses, through the kernel's IOPCIDevice MemoryRead/Write, ran in the same commit after the link went down and never faulted. So every access to the VRAM aperture goes through the kernel: rt/aperture.h's read/write/copy/fill route through ops the dext installs with the PCI device (BAR0 MemoryRead/MemoryWrite 8 to 64 bits, BAR0's index and size read once). linux/io.h's readX/writeX, memcpy_toio, memcpy_fromio and memset_io, the 64-bit MMIO atomics and the string functions (memcpy, memset, memmove, memcmp) route aperture addresses through them; the gate still skips writes and reads all ones once the device is known gone. The GART page table in VRAM, written with writeq on every GTT bind, now goes this way too. dmub_cmd.h's inline dmub_rb_push_front (a byte loop) and dmub_rb_flush_pending (READ_ONCE) reach the inbox with plain pointer accesses no shim can route. A declared compile intervention for dmub_srv.c (rt/dmub_inbox.h) includes dmub_cmd.h first and redirects its two calls to the same operations written with dmub_memcpy, as upstream's dmub_rb_out_push_front copies. Upstream sources stay unchanged. Offline proof: the CS fixture gives the driver VRAM only as a no-access alias of its pages, reached through the aperture's ops; the host library's upstream objects alias the string functions as the dext's do. Any direct load or store through a kernel VRAM pointer now crashes the offline tests. With the two DMUB helpers redirected, every test passes: the display pipeline (with its removal check now on the fixture's real aperture), scanout, surface import, CS selftest, KFD and the rest.
This commit is contained in:
1 parent
958d9307f7
commit
4968adb4de
18 files changed
+586
-98
No files matched your search
@@ -196,6 +196,9 @@ $(foreach h,$(UPSTREAM_HELPERS),$(eval $(call helper_rule,$(BUILD),HOSTCFLAGS,$(
|
||||
# scripts/verify-upstream.py). Route only the GFX12 GMC location call through
|
||||
# the host-window policy; amdgpu_gmc.c retains its original symbol.
|
||||
$(BUILD)/driver/amdgpu/gmc_v12_0.o: HOSTCFLAGS += -Damdgpu_gmc_gart_location=rt_amdgpu_gmc_gart_location
|
||||
# DMUB's inbox ring helpers reach VRAM through memcpy (rt/dmub_inbox.h).
|
||||
$(BUILD)/driver/display/dmub/src/dmub_srv.o: HOSTCFLAGS += -include rt/dmub_inbox.h
|
||||
$(BUILD)/driver/display/dmub/src/dmub_srv.o: linuxu/headers/rt/dmub_inbox.h
|
||||
|
||||
# These upstream BUILD_BUG_ON checks fold table accesses or sizeof-derived
|
||||
# local variables. Linux uses optimization; -O0 cannot prove the conditions.
|
||||
@@ -203,6 +206,11 @@ FOLDED_ASSERT_OBJECTS := drm-core/drm_edid.o \
|
||||
pm/swsmu/smu11/arcturus_ppt.o pm/swsmu/smu11/navi10_ppt.o \
|
||||
pm/swsmu/smu11/sienna_cichlid_ppt.o pm/swsmu/smu13/aldebaran_ppt.o
|
||||
$(addprefix $(BUILD)/driver/,$(FOLDED_ASSERT_OBJECTS)): HOSTCFLAGS += -O2 -fno-strict-aliasing
|
||||
# The library's upstream objects alias the string functions as the dext's
|
||||
# do (rt/device_string.h), so their VRAM aperture accesses take the same
|
||||
# route offline and the CS fixture's no-access aperture catches any direct
|
||||
# one. linuxu objects, which tests also link one by one, keep libc's.
|
||||
$(DRIVER_OBJS): HOSTCFLAGS += -DLINUXU_DEVICE_STRING_ALIASES=1 -include rt/device_string.h
|
||||
|
||||
# Pinned generic FIFO helper expects the Linux allocator's core macro includes.
|
||||
$(BUILD)/linuxu/shims/kfifo.o: HOSTCFLAGS += -include linux/kernel.h -include linux/bug.h
|
||||
@@ -255,6 +263,8 @@ $(eval $(call compile_rules,$(DK_BUILD),DK_CFLAGS))
|
||||
$(foreach h,$(UPSTREAM_HELPERS),$(eval $(call helper_rule,$(DK_BUILD),DK_CFLAGS,$(word 1,$(subst :, ,$(h))),$(word 2,$(subst :, ,$(h))))))
|
||||
|
||||
$(DK_BUILD)/driver/amdgpu/gmc_v12_0.o: DK_CFLAGS += -Damdgpu_gmc_gart_location=rt_amdgpu_gmc_gart_location
|
||||
$(DK_BUILD)/driver/display/dmub/src/dmub_srv.o: DK_CFLAGS += -include rt/dmub_inbox.h
|
||||
$(DK_BUILD)/driver/display/dmub/src/dmub_srv.o: linuxu/headers/rt/dmub_inbox.h
|
||||
$(addprefix $(DK_BUILD)/driver/,$(FOLDED_ASSERT_OBJECTS)): DK_CFLAGS += -O2 -fno-strict-aliasing
|
||||
$(DK_BUILD)/linuxu/shims/kfifo.o: DK_CFLAGS += -include linux/kernel.h -include linux/bug.h
|
||||
$(DK_BUILD)/linuxu/shims/sort.o: DK_CFLAGS += -include linux/compiler.h -include linux/preempt.h
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <rt/dext_pci.h>
|
||||
#include <rt/device_string.h>
|
||||
#include <rt/dext_dma.h>
|
||||
#include <rt/fatal.h>
|
||||
/* rt/device_string.h's aperture gate (not the header: it redefines memcpy). */
|
||||
@@ -80,6 +81,7 @@ public:
|
||||
dext_pci_operation(const dext_pci_operation &) = delete;
|
||||
dext_pci_operation &operator=(const dext_pci_operation &) = delete;
|
||||
};
|
||||
static void dext_aperture_install(void);
|
||||
/* Primary fake-MMIO token for the register BAR. 0 until dext_open mints
|
||||
* it. Its window is the whole BAR as assigned (see dext_open). */
|
||||
static uint32_t g_reg_token;
|
||||
@@ -208,6 +210,7 @@ extern "C" int dext_set_pci(void *pci_device, void *client)
|
||||
g_pci = static_cast<IOPCIDevice *>(pci_device);
|
||||
g_pci_client = static_cast<IOService *>(client);
|
||||
g_pci_open = false;
|
||||
dext_aperture_install(); /* VRAM only through the kernel, before any mapping */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -920,6 +923,74 @@ int dext_mem_write64(uint32_t token, uint64_t offset, uint64_t val)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The VRAM aperture's accesses (rt/device_string.h): BAR0 through the
|
||||
* kernel's MemoryRead/MemoryWrite, as registers are, never a CPU access
|
||||
* through a mapping of the BAR. A device that left the bus answers reads
|
||||
* with all ones here, and a write to it is dropped by the kernel; a CPU
|
||||
* store through a mapping instead panics the Mac (builds 239 and 240). */
|
||||
/* BAR0's memory index and size, read once per device (g_pci). */
|
||||
static IOPCIDevice *g_bar0_pci;
|
||||
static uint8_t g_bar0_index;
|
||||
static uint64_t g_bar0_size;
|
||||
static bool dext_bar0_info(uint8_t *mi, uint64_t *size)
|
||||
{
|
||||
if (g_bar0_pci != g_pci) {
|
||||
uint8_t index = 0, type = 0;
|
||||
uint64_t length = 0;
|
||||
if (g_pci->GetBARInfo(0, &index, &length, &type) != kIOReturnSuccess || !length)
|
||||
return false;
|
||||
g_bar0_index = index;
|
||||
g_bar0_size = length;
|
||||
g_bar0_pci = g_pci;
|
||||
}
|
||||
*mi = g_bar0_index;
|
||||
*size = g_bar0_size;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void dext_aperture_read(uint64_t offset, void *value, unsigned int width)
|
||||
{
|
||||
uint64_t v = UINT64_MAX;
|
||||
dext_pci_operation operation;
|
||||
uint8_t mi = 0;
|
||||
uint64_t size = 0;
|
||||
if (operation && dext_bar0_info(&mi, &size) && offset < size && width <= size - offset) {
|
||||
switch (width) {
|
||||
case 1: { uint8_t x = UINT8_MAX; g_pci->MemoryRead8(mi, offset, &x); v = x; break; }
|
||||
case 2: { uint16_t x = UINT16_MAX; g_pci->MemoryRead16(mi, offset, &x); v = x; break; }
|
||||
case 4: { uint32_t x = UINT32_MAX; g_pci->MemoryRead32(mi, offset, &x); v = x; break; }
|
||||
default: g_pci->MemoryRead64(mi, offset, &v); break;
|
||||
}
|
||||
}
|
||||
for (unsigned int i = 0; i < width; i++)
|
||||
static_cast<uint8_t *>(value)[i] = (uint8_t)(v >> (8 * i));
|
||||
}
|
||||
|
||||
static void dext_aperture_write(uint64_t offset, const void *value, unsigned int width)
|
||||
{
|
||||
uint64_t v = 0;
|
||||
for (unsigned int i = 0; i < width; i++)
|
||||
v |= (uint64_t)static_cast<const uint8_t *>(value)[i] << (8 * i);
|
||||
dext_pci_operation operation;
|
||||
uint8_t mi = 0;
|
||||
uint64_t size = 0;
|
||||
if (!operation || !dext_bar0_info(&mi, &size) || offset >= size || width > size - offset)
|
||||
return;
|
||||
switch (width) {
|
||||
case 1: g_pci->MemoryWrite8(mi, offset, (uint8_t)v); break;
|
||||
case 2: g_pci->MemoryWrite16(mi, offset, (uint16_t)v); break;
|
||||
case 4: g_pci->MemoryWrite32(mi, offset, (uint32_t)v); break;
|
||||
default: g_pci->MemoryWrite64(mi, offset, v); break;
|
||||
}
|
||||
}
|
||||
|
||||
static const struct linuxu_aperture_ops g_aperture_ops = { dext_aperture_read, dext_aperture_write };
|
||||
extern "C" void dext_bar0_set_aperture_ops(const struct linuxu_aperture_ops *ops);
|
||||
static void dext_aperture_install(void)
|
||||
{
|
||||
dext_bar0_set_aperture_ops(&g_aperture_ops);
|
||||
}
|
||||
|
||||
typedef int (*dext_irq_handler_t)(int irq, void *arg);
|
||||
|
||||
/* The rt-registered handler the KMD installed via request_irq
|
||||
|
||||
@@ -41,6 +41,16 @@
|
||||
#include <rt/dext_dma.h>
|
||||
/* rt/device_string.h's aperture gate (not the header: it redefines memcpy). */
|
||||
extern "C" void linuxu_aperture_set(uintptr_t base, uint64_t size);
|
||||
struct linuxu_aperture_ops;
|
||||
extern "C" void linuxu_aperture_set_ops(const struct linuxu_aperture_ops *ops);
|
||||
/* The aperture's kernel accesses, set by dext_main.mm with the PCI device
|
||||
* (dext_bar0_set_aperture_ops). The bridge's own tests set none: their
|
||||
* aperture is plain memory. */
|
||||
static const struct linuxu_aperture_ops *g_bar0_aperture_ops;
|
||||
extern "C" void dext_bar0_set_aperture_ops(const struct linuxu_aperture_ops *ops)
|
||||
{
|
||||
g_bar0_aperture_ops = ops;
|
||||
}
|
||||
extern "C" void linuxu_aperture_gone(const char *why);
|
||||
extern "C" int linuxu_aperture_is_gone(void);
|
||||
|
||||
@@ -764,6 +774,9 @@ void *dext_bar0_cpu_map(uint64_t offset, uint64_t size)
|
||||
g_bar0_cpu_base = map->GetAddress();
|
||||
g_bar0_cpu_size = visible_size;
|
||||
g_bar0_cpu_refs = 1;
|
||||
/* Every access to the aperture goes through the kernel (dext_main.mm);
|
||||
* the mapping only gives the driver's pointers their addresses. */
|
||||
linuxu_aperture_set_ops(g_bar0_aperture_ops);
|
||||
linuxu_aperture_set((uintptr_t)g_bar0_cpu_base, g_bar0_cpu_size);
|
||||
void *address = reinterpret_cast<void *>(g_bar0_cpu_base + offset);
|
||||
dext_dma_release();
|
||||
|
||||
+108
-37
@@ -22,6 +22,7 @@
|
||||
#endif
|
||||
|
||||
#include <rt/rt.h>
|
||||
#include <rt/aperture.h>
|
||||
|
||||
#if defined(LINUXU_DEXT_DK)
|
||||
#include <rt/dext_dma.h>
|
||||
@@ -41,56 +42,47 @@ static inline uint64_t linuxu_dk_offset(const void __iomem *addr)
|
||||
}
|
||||
extern uint16_t rt_mmio_readw(struct rt_device *, void *, uint64_t);
|
||||
extern void rt_mmio_writew(struct rt_device *, void *, uint64_t, uint16_t);
|
||||
/* Direct BAR0 CPU-mapping accesses follow Linux arm64 ordering: a write
|
||||
* barrier before each store, so descriptors and ring contents written to
|
||||
* DMA memory are visible to the GPU before the register/doorbell write;
|
||||
* a read barrier after each load, so later reads of DMA memory cannot be
|
||||
* satisfied before the register read that reported completion. Accesses
|
||||
* of the natural width are single, untorn loads/stores. The token path is
|
||||
* an RPC whose call boundary (and the dext's doorbell fence) already
|
||||
* orders it, so it takes no extra barrier here. No _relaxed variants
|
||||
* exist yet; they would omit both barriers. */
|
||||
/* The VRAM aperture (amdgpu's aper_base_kaddr, TTM kmaps of VRAM) is
|
||||
* reached only through the kernel (rt/device_string.h): never a CPU load
|
||||
* or store through a mapping of the BAR, which panics the Mac once the
|
||||
* device has left the bus. The call orders the access as dma_wmb/dma_rmb
|
||||
* would around a store or load. */
|
||||
#define linuxu_bar0_read(type, addr) ({ \
|
||||
type __v = (type)~(type)0; \
|
||||
if (!dext_pci_removed()) { \
|
||||
__v = *(const volatile type *)(addr); \
|
||||
dma_rmb(); \
|
||||
} \
|
||||
type __v; \
|
||||
linuxu_aperture_read((addr), &__v, sizeof(type)); \
|
||||
__v; \
|
||||
})
|
||||
#define linuxu_bar0_write(type, v, addr) do { \
|
||||
if (!dext_pci_removed()) { \
|
||||
dma_wmb(); \
|
||||
*(volatile type *)(addr) = (v); \
|
||||
} \
|
||||
type __v = (v); \
|
||||
linuxu_aperture_write((addr), &__v, sizeof(type)); \
|
||||
} while (0)
|
||||
static inline u8 readb(const void __iomem *addr)
|
||||
{
|
||||
if (dext_bar0_cpu_contains(addr, sizeof(u8)))
|
||||
if (linuxu_aperture_contains(addr, sizeof(u8)))
|
||||
return linuxu_bar0_read(u8, addr);
|
||||
return rt_mmio_readb(NULL, linuxu_dk_token(addr), linuxu_dk_offset(addr));
|
||||
}
|
||||
static inline u16 readw(const void __iomem *addr)
|
||||
{
|
||||
if (dext_bar0_cpu_contains(addr, sizeof(u16)))
|
||||
if (linuxu_aperture_contains(addr, sizeof(u16)))
|
||||
return linuxu_bar0_read(u16, addr);
|
||||
return rt_mmio_readw(NULL, linuxu_dk_token(addr), linuxu_dk_offset(addr));
|
||||
}
|
||||
static inline u32 readl(const void __iomem *addr)
|
||||
{
|
||||
if (dext_bar0_cpu_contains(addr, sizeof(u32)))
|
||||
if (linuxu_aperture_contains(addr, sizeof(u32)))
|
||||
return linuxu_bar0_read(u32, addr);
|
||||
return rt_mmio_readl(NULL, linuxu_dk_token(addr), linuxu_dk_offset(addr));
|
||||
}
|
||||
static inline u64 readq(const void __iomem *addr)
|
||||
{
|
||||
if (dext_bar0_cpu_contains(addr, sizeof(u64)))
|
||||
if (linuxu_aperture_contains(addr, sizeof(u64)))
|
||||
return linuxu_bar0_read(u64, addr);
|
||||
return rt_mmio_readq(NULL, linuxu_dk_token(addr), linuxu_dk_offset(addr));
|
||||
}
|
||||
static inline void writeb(u8 v, void __iomem *addr)
|
||||
{
|
||||
if (dext_bar0_cpu_contains(addr, sizeof(u8))) {
|
||||
if (linuxu_aperture_contains(addr, sizeof(u8))) {
|
||||
linuxu_bar0_write(u8, v, addr);
|
||||
return;
|
||||
}
|
||||
@@ -98,7 +90,7 @@ static inline void writeb(u8 v, void __iomem *addr)
|
||||
}
|
||||
static inline void writew(u16 v, void __iomem *addr)
|
||||
{
|
||||
if (dext_bar0_cpu_contains(addr, sizeof(u16))) {
|
||||
if (linuxu_aperture_contains(addr, sizeof(u16))) {
|
||||
linuxu_bar0_write(u16, v, addr);
|
||||
return;
|
||||
}
|
||||
@@ -106,7 +98,7 @@ static inline void writew(u16 v, void __iomem *addr)
|
||||
}
|
||||
static inline void writel(u32 v, void __iomem *addr)
|
||||
{
|
||||
if (dext_bar0_cpu_contains(addr, sizeof(u32))) {
|
||||
if (linuxu_aperture_contains(addr, sizeof(u32))) {
|
||||
linuxu_bar0_write(u32, v, addr);
|
||||
return;
|
||||
}
|
||||
@@ -114,7 +106,7 @@ static inline void writel(u32 v, void __iomem *addr)
|
||||
}
|
||||
static inline void writeq(u64 v, void __iomem *addr)
|
||||
{
|
||||
if (dext_bar0_cpu_contains(addr, sizeof(u64))) {
|
||||
if (linuxu_aperture_contains(addr, sizeof(u64))) {
|
||||
linuxu_bar0_write(u64, v, addr);
|
||||
return;
|
||||
}
|
||||
@@ -123,34 +115,70 @@ static inline void writeq(u64 v, void __iomem *addr)
|
||||
#elif !defined(LINUXU_RT_HOST_SHADOW)
|
||||
static inline u8 readb(const void __iomem *addr)
|
||||
{
|
||||
if (linuxu_aperture_contains(addr, sizeof(u8))) {
|
||||
u8 __v;
|
||||
linuxu_aperture_read(addr, &__v, sizeof(__v));
|
||||
return __v;
|
||||
}
|
||||
return *(const u8 __iomem *)addr;
|
||||
}
|
||||
static inline u16 readw(const void __iomem *addr)
|
||||
{
|
||||
if (linuxu_aperture_contains(addr, sizeof(u16))) {
|
||||
u16 __v;
|
||||
linuxu_aperture_read(addr, &__v, sizeof(__v));
|
||||
return __v;
|
||||
}
|
||||
return *(const u16 __iomem *)addr;
|
||||
}
|
||||
static inline u32 readl(const void __iomem *addr)
|
||||
{
|
||||
if (linuxu_aperture_contains(addr, sizeof(u32))) {
|
||||
u32 __v;
|
||||
linuxu_aperture_read(addr, &__v, sizeof(__v));
|
||||
return __v;
|
||||
}
|
||||
return *(const u32 __iomem *)addr;
|
||||
}
|
||||
static inline u64 readq(const void __iomem *addr)
|
||||
{
|
||||
if (linuxu_aperture_contains(addr, sizeof(u64))) {
|
||||
u64 __v;
|
||||
linuxu_aperture_read(addr, &__v, sizeof(__v));
|
||||
return __v;
|
||||
}
|
||||
return *(const u64 __iomem *)addr;
|
||||
}
|
||||
static inline void writeb(u8 v, void __iomem *addr)
|
||||
{
|
||||
if (linuxu_aperture_contains(addr, sizeof(u8))) {
|
||||
linuxu_aperture_write(addr, &v, sizeof(v));
|
||||
return;
|
||||
}
|
||||
*(u8 __iomem *)addr = v;
|
||||
}
|
||||
static inline void writew(u16 v, void __iomem *addr)
|
||||
{
|
||||
if (linuxu_aperture_contains(addr, sizeof(u16))) {
|
||||
linuxu_aperture_write(addr, &v, sizeof(v));
|
||||
return;
|
||||
}
|
||||
*(u16 __iomem *)addr = v;
|
||||
}
|
||||
static inline void writel(u32 v, void __iomem *addr)
|
||||
{
|
||||
if (linuxu_aperture_contains(addr, sizeof(u32))) {
|
||||
linuxu_aperture_write(addr, &v, sizeof(v));
|
||||
return;
|
||||
}
|
||||
*(u32 __iomem *)addr = v;
|
||||
}
|
||||
static inline void writeq(u64 v, void __iomem *addr)
|
||||
{
|
||||
if (linuxu_aperture_contains(addr, sizeof(u64))) {
|
||||
linuxu_aperture_write(addr, &v, sizeof(v));
|
||||
return;
|
||||
}
|
||||
*(u64 __iomem *)addr = v;
|
||||
}
|
||||
#else
|
||||
@@ -175,6 +203,11 @@ extern const struct mmio_slot *rt_mmio_slot_lookup(uint32_t token, size_t *off);
|
||||
|
||||
static inline u8 readb(const void __iomem *addr)
|
||||
{
|
||||
if (linuxu_aperture_contains(addr, sizeof(u8))) {
|
||||
u8 __v;
|
||||
linuxu_aperture_read(addr, &__v, sizeof(__v));
|
||||
return __v;
|
||||
}
|
||||
uint32_t token = (uintptr_t)addr;
|
||||
size_t off = (uintptr_t)addr - (uintptr_t)token;
|
||||
const struct mmio_slot *s = rt_mmio_slot_lookup(token, &off);
|
||||
@@ -182,6 +215,11 @@ static inline u8 readb(const void __iomem *addr)
|
||||
}
|
||||
static inline u16 readw(const void __iomem *addr)
|
||||
{
|
||||
if (linuxu_aperture_contains(addr, sizeof(u16))) {
|
||||
u16 __v;
|
||||
linuxu_aperture_read(addr, &__v, sizeof(__v));
|
||||
return __v;
|
||||
}
|
||||
uint32_t token = (uintptr_t)addr;
|
||||
size_t off = (uintptr_t)addr - (uintptr_t)token;
|
||||
const struct mmio_slot *s = rt_mmio_slot_lookup(token, &off);
|
||||
@@ -189,6 +227,11 @@ static inline u16 readw(const void __iomem *addr)
|
||||
}
|
||||
static inline u32 readl(const void __iomem *addr)
|
||||
{
|
||||
if (linuxu_aperture_contains(addr, sizeof(u32))) {
|
||||
u32 __v;
|
||||
linuxu_aperture_read(addr, &__v, sizeof(__v));
|
||||
return __v;
|
||||
}
|
||||
uint32_t token = (uintptr_t)addr;
|
||||
size_t off = (uintptr_t)addr - (uintptr_t)token;
|
||||
const struct mmio_slot *s = rt_mmio_slot_lookup(token, &off);
|
||||
@@ -196,6 +239,11 @@ static inline u32 readl(const void __iomem *addr)
|
||||
}
|
||||
static inline u64 readq(const void __iomem *addr)
|
||||
{
|
||||
if (linuxu_aperture_contains(addr, sizeof(u64))) {
|
||||
u64 __v;
|
||||
linuxu_aperture_read(addr, &__v, sizeof(__v));
|
||||
return __v;
|
||||
}
|
||||
uint32_t token = (uintptr_t)addr;
|
||||
size_t off = (uintptr_t)addr - (uintptr_t)token;
|
||||
const struct mmio_slot *s = rt_mmio_slot_lookup(token, &off);
|
||||
@@ -203,6 +251,10 @@ static inline u64 readq(const void __iomem *addr)
|
||||
}
|
||||
static inline void writeb(u8 v, void __iomem *addr)
|
||||
{
|
||||
if (linuxu_aperture_contains(addr, sizeof(u8))) {
|
||||
linuxu_aperture_write(addr, &v, sizeof(v));
|
||||
return;
|
||||
}
|
||||
uint32_t token = (uintptr_t)addr;
|
||||
size_t off = (uintptr_t)addr - (uintptr_t)token;
|
||||
const struct mmio_slot *s = rt_mmio_slot_lookup(token, &off);
|
||||
@@ -211,6 +263,10 @@ static inline void writeb(u8 v, void __iomem *addr)
|
||||
}
|
||||
static inline void writew(u16 v, void __iomem *addr)
|
||||
{
|
||||
if (linuxu_aperture_contains(addr, sizeof(u16))) {
|
||||
linuxu_aperture_write(addr, &v, sizeof(v));
|
||||
return;
|
||||
}
|
||||
uint32_t token = (uintptr_t)addr;
|
||||
size_t off = (uintptr_t)addr - (uintptr_t)token;
|
||||
const struct mmio_slot *s = rt_mmio_slot_lookup(token, &off);
|
||||
@@ -219,6 +275,10 @@ static inline void writew(u16 v, void __iomem *addr)
|
||||
}
|
||||
static inline void writel(u32 v, void __iomem *addr)
|
||||
{
|
||||
if (linuxu_aperture_contains(addr, sizeof(u32))) {
|
||||
linuxu_aperture_write(addr, &v, sizeof(v));
|
||||
return;
|
||||
}
|
||||
uint32_t token = (uintptr_t)addr;
|
||||
size_t off = (uintptr_t)addr - (uintptr_t)token;
|
||||
const struct mmio_slot *s = rt_mmio_slot_lookup(token, &off);
|
||||
@@ -227,6 +287,10 @@ static inline void writel(u32 v, void __iomem *addr)
|
||||
}
|
||||
static inline void writeq(u64 v, void __iomem *addr)
|
||||
{
|
||||
if (linuxu_aperture_contains(addr, sizeof(u64))) {
|
||||
linuxu_aperture_write(addr, &v, sizeof(v));
|
||||
return;
|
||||
}
|
||||
uint32_t token = (uintptr_t)addr;
|
||||
size_t off = (uintptr_t)addr - (uintptr_t)token;
|
||||
const struct mmio_slot *s = rt_mmio_slot_lookup(token, &off);
|
||||
@@ -246,27 +310,31 @@ static inline void ioport_unmap(void __iomem *addr)
|
||||
static inline void memcpy_fromio(void *to, const void __iomem *from, size_t count)
|
||||
{
|
||||
#ifdef LINUXU_DEXT_DK
|
||||
if (dext_bar0_cpu_contains(from, count)) {
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
((u8 *)to)[i] = dext_pci_removed() ? 0xff : ((const volatile u8 *)from)[i];
|
||||
if (linuxu_aperture_contains(from, count)) {
|
||||
linuxu_aperture_copy_out(to, from, count);
|
||||
return;
|
||||
}
|
||||
rt_mmio_memcpy_fromio(to, linuxu_dk_token(from), linuxu_dk_offset(from), count, NULL);
|
||||
#else
|
||||
__builtin_memcpy(to, from, count);
|
||||
if (linuxu_aperture_contains(from, count))
|
||||
linuxu_aperture_copy_out(to, from, count);
|
||||
else
|
||||
__builtin_memcpy(to, from, count);
|
||||
#endif
|
||||
}
|
||||
static inline void memcpy_toio(void __iomem *to, const void *from, size_t count)
|
||||
{
|
||||
#ifdef LINUXU_DEXT_DK
|
||||
if (dext_bar0_cpu_contains(to, count)) {
|
||||
for (size_t i = 0; i < count && !dext_pci_removed(); ++i)
|
||||
((volatile u8 *)to)[i] = ((const u8 *)from)[i];
|
||||
if (linuxu_aperture_contains(to, count)) {
|
||||
linuxu_aperture_copy_in(to, from, count);
|
||||
return;
|
||||
}
|
||||
rt_mmio_memcpy_toio(linuxu_dk_token(to), from, linuxu_dk_offset(to), count, NULL);
|
||||
#else
|
||||
__builtin_memcpy(to, from, count);
|
||||
if (linuxu_aperture_contains(to, count))
|
||||
linuxu_aperture_copy_in(to, from, count);
|
||||
else
|
||||
__builtin_memcpy(to, from, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -326,15 +394,18 @@ static inline void iounmap(const volatile void __iomem *addr)
|
||||
static inline void *memset_io(void __iomem *addr, int val, size_t count)
|
||||
{
|
||||
#ifdef LINUXU_DEXT_DK
|
||||
if (dext_bar0_cpu_contains(addr, count)) {
|
||||
for (size_t i = 0; i < count && !dext_pci_removed(); ++i)
|
||||
((volatile u8 *)addr)[i] = (u8)val;
|
||||
if (linuxu_aperture_contains(addr, count)) {
|
||||
linuxu_aperture_fill(addr, val, count);
|
||||
return (void *)addr;
|
||||
}
|
||||
for (size_t i = 0; i < count; i++)
|
||||
writeb((u8)val, (void __iomem *)((uintptr_t)addr + i));
|
||||
return (void *)addr;
|
||||
#else
|
||||
if (linuxu_aperture_contains(addr, count)) {
|
||||
linuxu_aperture_fill(addr, val, count);
|
||||
return (void *)addr;
|
||||
}
|
||||
return memset((void *)addr, val, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/* The VRAM aperture's accesses (declarations only; device_string.c). Kept
|
||||
* apart from rt/device_string.h, which also aliases the string functions,
|
||||
* so linux/io.h can route through it without the aliases. */
|
||||
#ifndef LINUXU_RT_APERTURE_H
|
||||
#define LINUXU_RT_APERTURE_H
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* The VRAM aperture: the address range kernel VRAM mappings (amdgpu's
|
||||
* aper_base_kaddr, TTM kmaps) point into. A CPU store or load through a
|
||||
* user-space mapping of the BAR to a device that has left the bus (a
|
||||
* Thunderbolt unplug) is not an error the process can see: on Apple
|
||||
* silicon it is an uncorrectable bus error that panics the Mac, and it is
|
||||
* reported only after the store retired, so no check before the store can
|
||||
* prevent it (build 240's panic: the DMUB inbox push, with the removal
|
||||
* already under way). So no access goes through such a mapping: every
|
||||
* access to the aperture goes through @ops (the dext: the kernel's
|
||||
* IOPCIDevice MemoryRead/MemoryWrite on BAR0, which register accesses
|
||||
* have always used, through unplugs, without a fault). The string
|
||||
* functions below and linux/io.h's accessors route through it; a direct
|
||||
* dereference of an aperture pointer is a bug (the CS fixture backs the
|
||||
* aperture with no-access memory so the offline tests find any).
|
||||
*
|
||||
* Without @ops the aperture is plain memory (host tests of the gate).
|
||||
* Once the device is known gone (linuxu_aperture_gone), writes are
|
||||
* skipped and reads return all ones, without a kernel call. */
|
||||
struct linuxu_aperture_ops {
|
||||
/* @width (1, 2, 4 or 8, aligned) bytes at byte @offset into the aperture. */
|
||||
void (*read)(uint64_t offset, void *value, unsigned int width);
|
||||
void (*write)(uint64_t offset, const void *value, unsigned int width);
|
||||
};
|
||||
void linuxu_aperture_set(uintptr_t base, uint64_t size);
|
||||
void linuxu_aperture_set_ops(const struct linuxu_aperture_ops *ops);
|
||||
void linuxu_aperture_gone(const char *why);
|
||||
int linuxu_aperture_is_gone(void);
|
||||
int linuxu_aperture_contains(const volatile void *address, size_t size);
|
||||
void linuxu_aperture_read(const volatile void *address, void *value, unsigned int width);
|
||||
void linuxu_aperture_write(volatile void *address, const void *value, unsigned int width);
|
||||
void linuxu_aperture_copy_in(volatile void *destination, const void *source, size_t size);
|
||||
void linuxu_aperture_copy_out(void *destination, const volatile void *source, size_t size);
|
||||
void linuxu_aperture_fill(volatile void *destination, int value, size_t size);
|
||||
struct linuxu_aperture_stats {
|
||||
unsigned long long stores, loads; /* operations into and out of it */
|
||||
unsigned long long skipped; /* refused once gone */
|
||||
unsigned long long calls; /* accesses through the ops */
|
||||
};
|
||||
void linuxu_aperture_stats(struct linuxu_aperture_stats *out);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <rt/aperture.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -16,31 +17,16 @@ void *linuxu_device_memmove(void *, const void *, size_t);
|
||||
int linuxu_device_memcmp(const void *, const void *, size_t);
|
||||
void linuxu_device_bzero(void *, size_t);
|
||||
|
||||
/* The VRAM aperture the driver maps into its own address space
|
||||
* (dext_bar0_cpu_map). A CPU store or load through that mapping to a
|
||||
* device that has left the bus (a Thunderbolt power-off) is not an error
|
||||
* the process can see: on Apple silicon it is an uncorrectable bus error
|
||||
* that panics the Mac. Linux reaches the same state through
|
||||
* amdgpu_device_unmap_mmio after a hot unplug; here the mapping is gated:
|
||||
* once the device is known gone (linuxu_aperture_gone), the string
|
||||
* functions skip stores into the aperture and read all ones from it.
|
||||
* Accesses through kernel IOPCIDevice calls (registers, doorbells) are
|
||||
* refused by the kernel instead and need no gate. */
|
||||
void linuxu_aperture_set(uintptr_t base, uint64_t size);
|
||||
void linuxu_aperture_gone(const char *why);
|
||||
int linuxu_aperture_is_gone(void);
|
||||
struct linuxu_aperture_stats {
|
||||
unsigned long long stores, loads; /* string operations through it */
|
||||
unsigned long long skipped; /* refused once gone */
|
||||
};
|
||||
void linuxu_aperture_stats(struct linuxu_aperture_stats *out);
|
||||
/* The VRAM aperture: rt/aperture.h. */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Object-like aliases also cover function pointers. Explicit builtins occur
|
||||
* in upstream SMU headers; they must obey the same device-memory contract. */
|
||||
#ifdef LINUXU_DEXT_DK
|
||||
* in upstream SMU headers; they must obey the same device-memory contract.
|
||||
* Host builds of the driver alias them too (LINUXU_DEVICE_STRING_ALIASES),
|
||||
* so the offline tests route aperture accesses the way the dext does. */
|
||||
#if defined(LINUXU_DEXT_DK) || defined(LINUXU_DEVICE_STRING_ALIASES)
|
||||
#undef memset
|
||||
#undef memcpy
|
||||
#undef memmove
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/* Compile intervention for drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c
|
||||
* (patches/manifest.json): DMUB's inbox ring lives in VRAM, and two of
|
||||
* dmub_cmd.h's inline ring helpers touch it with plain pointer accesses,
|
||||
* a byte loop in dmub_rb_push_front and READ_ONCE in dmub_rb_flush_pending.
|
||||
* Through a CPU mapping of the BAR, the push is the store that panicked the
|
||||
* Mac when the GPU was unplugged (builds 239 and 240). Here dmub_cmd.h is
|
||||
* included first, as dmub_srv.c would include it, and dmub_srv.c's calls
|
||||
* are redirected to the same operations written with dmub_memcpy, as
|
||||
* upstream's own dmub_rb_out_push_front copies: memcpy reaches VRAM only
|
||||
* through the kernel (rt/device_string.h). The ring arithmetic is
|
||||
* unchanged. */
|
||||
#ifndef LINUXU_RT_DMUB_INBOX_H
|
||||
#define LINUXU_RT_DMUB_INBOX_H
|
||||
#include <rt/device_string.h> /* memcpy is the aperture's before these bodies */
|
||||
#include "dmub/dmub_srv.h"
|
||||
|
||||
static inline bool linuxu_dmub_rb_push_front(struct dmub_rb *rb, const union dmub_rb_cmd *cmd)
|
||||
{
|
||||
uint8_t *dst = (uint8_t *)(rb->base_address) + rb->wrpt;
|
||||
|
||||
if (rb->capacity == 0)
|
||||
return false;
|
||||
if (dmub_rb_full(rb))
|
||||
return false;
|
||||
dmub_memcpy(dst, cmd, DMUB_RB_CMD_SIZE);
|
||||
rb->wrpt += DMUB_RB_CMD_SIZE;
|
||||
if (rb->wrpt >= rb->capacity)
|
||||
rb->wrpt %= rb->capacity;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Read back every queued command, so the writes have reached VRAM before
|
||||
* the DMCUB is told; each read goes through the kernel as the writes did. */
|
||||
static inline void linuxu_dmub_rb_flush_pending(const struct dmub_rb *rb)
|
||||
{
|
||||
uint32_t rptr = rb->rptr;
|
||||
uint32_t wptr = rb->wrpt;
|
||||
uint64_t data[DMUB_RB_CMD_SIZE / sizeof(uint64_t)];
|
||||
|
||||
if (rb->capacity == 0)
|
||||
return;
|
||||
while (rptr != wptr) {
|
||||
dmub_memcpy(data, (uint8_t *)(rb->base_address) + rptr, DMUB_RB_CMD_SIZE);
|
||||
rptr += DMUB_RB_CMD_SIZE;
|
||||
if (rptr >= rb->capacity)
|
||||
rptr %= rb->capacity;
|
||||
}
|
||||
}
|
||||
|
||||
#define dmub_rb_push_front(rb, cmd) linuxu_dmub_rb_push_front(rb, cmd)
|
||||
#define dmub_rb_flush_pending(rb) linuxu_dmub_rb_flush_pending(rb)
|
||||
#endif
|
||||
+170
-20
@@ -8,9 +8,10 @@
|
||||
|
||||
typedef uint64_t device_word __attribute__((__may_alias__));
|
||||
|
||||
/* ---- the VRAM aperture gate (rt/device_string.h) ---- */
|
||||
/* ---- the VRAM aperture (rt/device_string.h) ---- */
|
||||
static uintptr_t aperture_lo, aperture_hi;
|
||||
static int aperture_gone_flag;
|
||||
static const struct linuxu_aperture_ops *aperture_ops;
|
||||
static struct linuxu_aperture_stats aperture_counts;
|
||||
|
||||
void linuxu_aperture_set(uintptr_t base, uint64_t size)
|
||||
@@ -22,6 +23,11 @@ void linuxu_aperture_set(uintptr_t base, uint64_t size)
|
||||
__atomic_store_n(&aperture_gone_flag, 0, __ATOMIC_RELEASE);
|
||||
}
|
||||
|
||||
void linuxu_aperture_set_ops(const struct linuxu_aperture_ops *ops)
|
||||
{
|
||||
__atomic_store_n(&aperture_ops, ops, __ATOMIC_RELEASE);
|
||||
}
|
||||
|
||||
/* Weak: the driver logs through printk.c; host tests print nothing. */
|
||||
__attribute__((weak)) void linuxu_aperture_report(const char *why) { (void)why; }
|
||||
|
||||
@@ -41,9 +47,10 @@ void linuxu_aperture_stats(struct linuxu_aperture_stats *out)
|
||||
out->stores = __atomic_load_n(&aperture_counts.stores, __ATOMIC_RELAXED);
|
||||
out->loads = __atomic_load_n(&aperture_counts.loads, __ATOMIC_RELAXED);
|
||||
out->skipped = __atomic_load_n(&aperture_counts.skipped, __ATOMIC_RELAXED);
|
||||
out->calls = __atomic_load_n(&aperture_counts.calls, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static inline int in_aperture(const volatile void *p, size_t size)
|
||||
int linuxu_aperture_contains(const volatile void *p, size_t size)
|
||||
{
|
||||
const uintptr_t a = (uintptr_t)p;
|
||||
const uintptr_t lo = __atomic_load_n(&aperture_lo, __ATOMIC_RELAXED);
|
||||
@@ -51,30 +58,144 @@ static inline int in_aperture(const volatile void *p, size_t size)
|
||||
return lo && size && a < __atomic_load_n(&aperture_hi, __ATOMIC_RELAXED) && a + size > lo;
|
||||
}
|
||||
|
||||
/* 1: skip the operation (the device is gone; @fill a load's destination
|
||||
* with all ones, as a read of a vanished device returns). */
|
||||
static inline int aperture_refuse(void *destination, const void *source, size_t size, int fill)
|
||||
static inline uint64_t aperture_offset(const volatile void *p)
|
||||
{
|
||||
const int to = in_aperture(destination, size), from = source && in_aperture(source, size);
|
||||
return (uint64_t)((uintptr_t)p - __atomic_load_n(&aperture_lo, __ATOMIC_RELAXED));
|
||||
}
|
||||
|
||||
if (!to && !from)
|
||||
return 0;
|
||||
__atomic_add_fetch(to ? &aperture_counts.stores : &aperture_counts.loads, 1, __ATOMIC_RELAXED);
|
||||
if (!__atomic_load_n(&aperture_gone_flag, __ATOMIC_ACQUIRE))
|
||||
return 0;
|
||||
__atomic_add_fetch(&aperture_counts.skipped, 1, __ATOMIC_RELAXED);
|
||||
if (fill && !to) {
|
||||
volatile unsigned char *d = destination;
|
||||
/* One access of @width bytes (aligned): through the ops, or plain memory
|
||||
* when the aperture has none (host tests). Once gone: skipped, ones. */
|
||||
static void aperture_access(volatile void *p, void *value, unsigned int width, int store)
|
||||
{
|
||||
const struct linuxu_aperture_ops *ops = __atomic_load_n(&aperture_ops, __ATOMIC_ACQUIRE);
|
||||
|
||||
while (size--) *d++ = 0xff;
|
||||
if (__atomic_load_n(&aperture_gone_flag, __ATOMIC_ACQUIRE)) {
|
||||
__atomic_add_fetch(&aperture_counts.skipped, 1, __ATOMIC_RELAXED);
|
||||
if (!store)
|
||||
for (unsigned int i = 0; i < width; i++) ((unsigned char *)value)[i] = 0xff;
|
||||
return;
|
||||
}
|
||||
if (ops) {
|
||||
__atomic_add_fetch(&aperture_counts.calls, 1, __ATOMIC_RELAXED);
|
||||
/* Earlier stores to normal memory (what the device will read)
|
||||
* reach memory before the device is told, as dma_wmb before a
|
||||
* BAR store; the call itself is the access. */
|
||||
__atomic_thread_fence(__ATOMIC_SEQ_CST);
|
||||
if (store)
|
||||
ops->write(aperture_offset(p), value, width);
|
||||
else
|
||||
ops->read(aperture_offset(p), value, width);
|
||||
return;
|
||||
}
|
||||
switch (width) {
|
||||
case 1: if (store) *(volatile uint8_t *)p = *(uint8_t *)value; else *(uint8_t *)value = *(volatile uint8_t *)p; break;
|
||||
case 2: if (store) *(volatile uint16_t *)p = *(uint16_t *)value; else *(uint16_t *)value = *(volatile uint16_t *)p; break;
|
||||
case 4: if (store) *(volatile uint32_t *)p = *(uint32_t *)value; else *(uint32_t *)value = *(volatile uint32_t *)p; break;
|
||||
default: if (store) *(volatile uint64_t *)p = *(uint64_t *)value; else *(uint64_t *)value = *(volatile uint64_t *)p; break;
|
||||
}
|
||||
}
|
||||
|
||||
void linuxu_aperture_read(const volatile void *p, void *value, unsigned int width)
|
||||
{
|
||||
__atomic_add_fetch(&aperture_counts.loads, 1, __ATOMIC_RELAXED);
|
||||
aperture_access((volatile void *)p, value, width, 0);
|
||||
}
|
||||
|
||||
void linuxu_aperture_write(volatile void *p, const void *value, unsigned int width)
|
||||
{
|
||||
__atomic_add_fetch(&aperture_counts.stores, 1, __ATOMIC_RELAXED);
|
||||
aperture_access(p, (void *)value, width, 1);
|
||||
}
|
||||
|
||||
/* The widest aligned access that fits at @address with @size left. */
|
||||
static inline unsigned int aperture_width(uintptr_t address, size_t size)
|
||||
{
|
||||
if (!(address & 7) && size >= 8) return 8;
|
||||
if (!(address & 3) && size >= 4) return 4;
|
||||
if (!(address & 1) && size >= 2) return 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void linuxu_aperture_copy_in(volatile void *destination, const void *source, size_t size)
|
||||
{
|
||||
volatile unsigned char *d = destination;
|
||||
const unsigned char *s = source;
|
||||
|
||||
__atomic_add_fetch(&aperture_counts.stores, 1, __ATOMIC_RELAXED);
|
||||
while (size) {
|
||||
const unsigned int w = aperture_width((uintptr_t)d, size);
|
||||
uint64_t v = 0;
|
||||
|
||||
for (unsigned int i = 0; i < w; i++) ((unsigned char *)&v)[i] = s[i];
|
||||
aperture_access(d, &v, w, 1);
|
||||
d += w; s += w; size -= w;
|
||||
}
|
||||
}
|
||||
|
||||
void linuxu_aperture_copy_out(void *destination, const volatile void *source, size_t size)
|
||||
{
|
||||
unsigned char *d = destination;
|
||||
const volatile unsigned char *s = source;
|
||||
|
||||
__atomic_add_fetch(&aperture_counts.loads, 1, __ATOMIC_RELAXED);
|
||||
while (size) {
|
||||
const unsigned int w = aperture_width((uintptr_t)s, size);
|
||||
uint64_t v = 0;
|
||||
|
||||
aperture_access((volatile void *)s, &v, w, 0);
|
||||
for (unsigned int i = 0; i < w; i++) d[i] = ((unsigned char *)&v)[i];
|
||||
d += w; s += w; size -= w;
|
||||
}
|
||||
}
|
||||
|
||||
void linuxu_aperture_fill(volatile void *destination, int value, size_t size)
|
||||
{
|
||||
volatile unsigned char *d = destination;
|
||||
const uint64_t pattern = (uint64_t)(unsigned char)value * UINT64_C(0x0101010101010101);
|
||||
|
||||
__atomic_add_fetch(&aperture_counts.stores, 1, __ATOMIC_RELAXED);
|
||||
while (size) {
|
||||
const unsigned int w = aperture_width((uintptr_t)d, size);
|
||||
uint64_t v = pattern;
|
||||
|
||||
aperture_access(d, &v, w, 1);
|
||||
d += w; size -= w;
|
||||
}
|
||||
}
|
||||
|
||||
/* Copies with an aperture end, through a bounce buffer when both are. */
|
||||
static void aperture_copy(void *destination, const void *source, size_t size)
|
||||
{
|
||||
const int to = linuxu_aperture_contains(destination, size);
|
||||
const int from = linuxu_aperture_contains(source, size);
|
||||
unsigned char bounce[256];
|
||||
|
||||
if (!to && !from) {
|
||||
volatile unsigned char *d = destination;
|
||||
const volatile unsigned char *s = source;
|
||||
|
||||
while (size--) *d++ = *s++;
|
||||
} else if (to && !from) {
|
||||
linuxu_aperture_copy_in(destination, source, size);
|
||||
} else if (from && !to) {
|
||||
linuxu_aperture_copy_out(destination, source, size);
|
||||
} else {
|
||||
for (size_t done = 0; done < size;) {
|
||||
const size_t n = size - done < sizeof(bounce) ? size - done : sizeof(bounce);
|
||||
|
||||
linuxu_aperture_copy_out(bounce, (const unsigned char *)source + done, n);
|
||||
linuxu_aperture_copy_in((unsigned char *)destination + done, bounce, n);
|
||||
done += n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void *linuxu_device_memset(void *destination, int value, size_t size)
|
||||
{
|
||||
if (aperture_refuse(destination, NULL, size, 0))
|
||||
if (linuxu_aperture_contains(destination, size)) {
|
||||
linuxu_aperture_fill(destination, value, size);
|
||||
return destination;
|
||||
}
|
||||
volatile unsigned char *d = destination;
|
||||
unsigned char byte = (unsigned char)value;
|
||||
device_word word = (device_word)byte * UINT64_C(0x0101010101010101);
|
||||
@@ -93,8 +214,10 @@ void *linuxu_device_memset(void *destination, int value, size_t size)
|
||||
|
||||
void *linuxu_device_memcpy(void *destination, const void *source, size_t size)
|
||||
{
|
||||
if (aperture_refuse(destination, source, size, 1))
|
||||
if (linuxu_aperture_contains(destination, size) || linuxu_aperture_contains(source, size)) {
|
||||
aperture_copy(destination, source, size);
|
||||
return destination;
|
||||
}
|
||||
volatile unsigned char *d = destination;
|
||||
const volatile unsigned char *s = source;
|
||||
/* If the alignments differ, byte accesses avoid unaligned device loads. */
|
||||
@@ -117,8 +240,21 @@ void *linuxu_device_memcpy(void *destination, const void *source, size_t size)
|
||||
void *linuxu_device_memmove(void *destination, const void *source, size_t size)
|
||||
{
|
||||
if (!size || destination == source) return destination;
|
||||
if (aperture_refuse(destination, source, size, 1))
|
||||
if (linuxu_aperture_contains(destination, size) || linuxu_aperture_contains(source, size)) {
|
||||
/* Overlapping moves within the aperture: chunks in the safe order. */
|
||||
unsigned char bounce[256];
|
||||
const int backward = (uintptr_t)destination > (uintptr_t)source;
|
||||
|
||||
for (size_t done = 0; done < size;) {
|
||||
const size_t n = size - done < sizeof(bounce) ? size - done : sizeof(bounce);
|
||||
const size_t at = backward ? size - done - n : done;
|
||||
|
||||
aperture_copy(bounce, (const unsigned char *)source + at, n);
|
||||
aperture_copy((unsigned char *)destination + at, bounce, n);
|
||||
done += n;
|
||||
}
|
||||
return destination;
|
||||
}
|
||||
if ((uintptr_t)destination < (uintptr_t)source ||
|
||||
(uintptr_t)destination - (uintptr_t)source >= size)
|
||||
return linuxu_device_memcpy(destination, source, size);
|
||||
@@ -142,8 +278,22 @@ void *linuxu_device_memmove(void *destination, const void *source, size_t size)
|
||||
|
||||
int linuxu_device_memcmp(const void *first, const void *second, size_t size)
|
||||
{
|
||||
if (linuxu_aperture_is_gone() && (in_aperture(first, size) || in_aperture(second, size)))
|
||||
return 1; /* nothing to compare on a vanished device */
|
||||
if (linuxu_aperture_contains(first, size) || linuxu_aperture_contains(second, size)) {
|
||||
unsigned char x[128], y[128];
|
||||
|
||||
if (linuxu_aperture_is_gone())
|
||||
return 1; /* nothing to compare on a vanished device */
|
||||
for (size_t done = 0; done < size;) {
|
||||
const size_t n = size - done < sizeof(x) ? size - done : sizeof(x);
|
||||
|
||||
aperture_copy(x, (const unsigned char *)first + done, n);
|
||||
aperture_copy(y, (const unsigned char *)second + done, n);
|
||||
for (size_t i = 0; i < n; i++)
|
||||
if (x[i] != y[i]) return (int)x[i] - (int)y[i];
|
||||
done += n;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
const volatile unsigned char *a = first, *b = second;
|
||||
while (size--) {
|
||||
unsigned char av = *a++, bv = *b++;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* work without hardware. DriverKit backend (LINUXU_DEXT): IOPCIDevice
|
||||
* MemoryRead32/64/MemoryWrite32/64 — skeleton with TODOs where the
|
||||
* DriverKit specifics need verification. */
|
||||
#include <rt/aperture.h>
|
||||
#include <pthread.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
@@ -85,8 +86,8 @@ static uint32_t atomic_mmio_token(const volatile void *addr,
|
||||
|
||||
int linuxu_atomic64_mmio_read(const volatile void *addr, uint64_t *value)
|
||||
{
|
||||
if (dext_bar0_cpu_contains((const void *)addr, sizeof(*value))) {
|
||||
*value = *(const volatile uint64_t *)addr;
|
||||
if (linuxu_aperture_contains(addr, sizeof(*value))) {
|
||||
linuxu_aperture_read(addr, value, sizeof(*value));
|
||||
return 1;
|
||||
}
|
||||
uint64_t offset;
|
||||
@@ -99,8 +100,8 @@ int linuxu_atomic64_mmio_read(const volatile void *addr, uint64_t *value)
|
||||
|
||||
int linuxu_atomic64_mmio_write(volatile void *addr, uint64_t value)
|
||||
{
|
||||
if (dext_bar0_cpu_contains((const void *)addr, sizeof(value))) {
|
||||
*(volatile uint64_t *)addr = value;
|
||||
if (linuxu_aperture_contains(addr, sizeof(value))) {
|
||||
linuxu_aperture_write(addr, &value, sizeof(value));
|
||||
return 1;
|
||||
}
|
||||
uint64_t offset;
|
||||
|
||||
@@ -28,7 +28,11 @@
|
||||
* The fixture's packets are not any real SDMA generation's: the point is
|
||||
* that upstream builds, schedules, fences and waits for them. */
|
||||
#include <assert.h>
|
||||
#include <mach/mach.h>
|
||||
#include <mach/mach_vm.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/mman.h>
|
||||
#include <rt/device_string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -87,6 +91,22 @@ enum {
|
||||
};
|
||||
#define FX_SDMA(op, count) (((uint32_t)(op) << 24) | (count))
|
||||
|
||||
/* VRAM: the fixture's own read-write view and the driver's no-access alias
|
||||
* of the same pages. A direct load or store through a kernel VRAM pointer
|
||||
* crashes the test, as it would panic the Mac at an unplug; accesses
|
||||
* through the aperture (rt/device_string.h, linux/io.h) reach the pages. */
|
||||
static uint8_t *vram_alias;
|
||||
static uint8_t *fixture_vram_create(void);
|
||||
/* The fixture's own view of a driver pointer: VRAM through the aperture
|
||||
* alias becomes the read-write view (the GPU, not the CPU, reads it). */
|
||||
static void *fixture_view(const void *driver_pointer);
|
||||
void *cs_fixture_host_view(const void *driver_pointer) { return fixture_view(driver_pointer); }
|
||||
static void fixture_aperture_read(uint64_t offset, void *value, unsigned int width);
|
||||
static void fixture_aperture_write(uint64_t offset, const void *value, unsigned int width);
|
||||
static const struct linuxu_aperture_ops fixture_aperture_ops = {
|
||||
fixture_aperture_read, fixture_aperture_write,
|
||||
};
|
||||
|
||||
static struct pci_dev *pdev;
|
||||
static struct amdgpu_device *adev;
|
||||
uint64_t cs_fixture_visible_vram;
|
||||
@@ -132,7 +152,7 @@ static uint8_t *mc_to_host(uint64_t mc)
|
||||
return vram + (mc - adev->gmc.vram_start);
|
||||
if (mc >= adev->gmc.gart_start && mc <= adev->gmc.gart_end) {
|
||||
uint64_t index = (mc - adev->gmc.gart_start) >> AMDGPU_GPU_PAGE_SHIFT;
|
||||
uint64_t entry = ((uint64_t *)adev->gart.ptr)[index];
|
||||
uint64_t entry = ((uint64_t *)fixture_view(adev->gart.ptr))[index];
|
||||
|
||||
if (!(entry & AMDGPU_PTE_VALID))
|
||||
return NULL;
|
||||
@@ -281,7 +301,7 @@ static struct engine *engine_of(struct amdgpu_ring *ring)
|
||||
|
||||
static uint64_t fx_get_rptr(struct amdgpu_ring *ring)
|
||||
{
|
||||
return *ring->rptr_cpu_addr;
|
||||
return *(volatile uint32_t *)fixture_view(ring->rptr_cpu_addr);
|
||||
}
|
||||
|
||||
static uint64_t fx_get_wptr(struct amdgpu_ring *ring)
|
||||
@@ -734,7 +754,7 @@ static void *engine_main(void *arg)
|
||||
dw[0], take > 1 ? dw[1] : 0, take > 2 ? dw[2] : 0, take > 3 ? dw[3] : 0);
|
||||
used = pm4 ? pm4_packet(e, dw, take, 0, 0) : sdma_packet(e, dw, take, 0, 0);
|
||||
e->rptr += used;
|
||||
*ring->rptr_cpu_addr = e->rptr;
|
||||
*(volatile uint32_t *)fixture_view(ring->rptr_cpu_addr) = e->rptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1256,7 +1276,7 @@ struct pci_dev *cs_fixture_init(void)
|
||||
fx_gfx_config();
|
||||
|
||||
/* The GMC's sw_init: memory layout, VM sizes, the GART table. */
|
||||
vram = calloc(1, FX_VRAM_BYTES);
|
||||
vram = fixture_vram_create();
|
||||
doorbells = calloc(1, FX_BAR2_BYTES);
|
||||
if (!vram || !doorbells)
|
||||
FX_ABORT("fixture memory");
|
||||
@@ -1291,7 +1311,12 @@ struct pci_dev *cs_fixture_init(void)
|
||||
r = amdgpu_ttm_init(adev);
|
||||
if (r)
|
||||
FX_ABORT("amdgpu_ttm_init = %d", r);
|
||||
adev->mman.aper_base_kaddr = vram;
|
||||
/* The driver's view of VRAM (aper_base_kaddr, TTM kmaps): an alias
|
||||
* that faults on any access, as the dext has no CPU mapping to use;
|
||||
* only the aperture's accesses reach it (fixture_aperture_ops). */
|
||||
adev->mman.aper_base_kaddr = vram_alias;
|
||||
linuxu_aperture_set_ops(&fixture_aperture_ops);
|
||||
linuxu_aperture_set((uintptr_t)vram_alias, FX_VRAM_BYTES);
|
||||
r = amdgpu_gart_init(adev);
|
||||
if (!r) {
|
||||
/* As gmc_v12_0_gart_init: the table in VRAM. */
|
||||
@@ -1378,6 +1403,48 @@ void cs_fixture_stats(struct cs_fixture_stats *out)
|
||||
pthread_mutex_unlock(&stats_lock);
|
||||
}
|
||||
|
||||
static uint8_t *fixture_vram_create(void)
|
||||
{
|
||||
void *rw = mmap(NULL, FX_VRAM_BYTES, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
|
||||
mach_vm_address_t alias = 0;
|
||||
vm_prot_t cur = 0, max = 0;
|
||||
|
||||
if (rw == MAP_FAILED)
|
||||
FX_ABORT("VRAM: mmap failed");
|
||||
if (mach_vm_remap(mach_task_self(), &alias, FX_VRAM_BYTES, 0, VM_FLAGS_ANYWHERE, mach_task_self(),
|
||||
(mach_vm_address_t)(uintptr_t)rw, FALSE, &cur, &max, VM_INHERIT_NONE) != KERN_SUCCESS)
|
||||
FX_ABORT("VRAM: the driver's alias could not be made");
|
||||
if (mprotect((void *)(uintptr_t)alias, FX_VRAM_BYTES, PROT_NONE))
|
||||
FX_ABORT("VRAM: the driver's alias could not be made inaccessible");
|
||||
vram_alias = (uint8_t *)(uintptr_t)alias;
|
||||
return rw;
|
||||
}
|
||||
|
||||
static void *fixture_view(const void *p)
|
||||
{
|
||||
const uintptr_t a = (uintptr_t)p, lo = (uintptr_t)vram_alias;
|
||||
|
||||
if (vram_alias && a >= lo && a - lo < FX_VRAM_BYTES)
|
||||
return vram + (a - lo);
|
||||
return (void *)(uintptr_t)p;
|
||||
}
|
||||
|
||||
static void fixture_aperture_read(uint64_t offset, void *value, unsigned int width)
|
||||
{
|
||||
if (offset >= FX_VRAM_BYTES || width > FX_VRAM_BYTES - offset)
|
||||
FX_ABORT("aperture read of %u bytes at 0x%llx, past VRAM", width, (unsigned long long)offset);
|
||||
for (unsigned int i = 0; i < width; i++)
|
||||
((uint8_t *)value)[i] = ((volatile uint8_t *)vram)[offset + i];
|
||||
}
|
||||
|
||||
static void fixture_aperture_write(uint64_t offset, const void *value, unsigned int width)
|
||||
{
|
||||
if (offset >= FX_VRAM_BYTES || width > FX_VRAM_BYTES - offset)
|
||||
FX_ABORT("aperture write of %u bytes at 0x%llx, past VRAM", width, (unsigned long long)offset);
|
||||
for (unsigned int i = 0; i < width; i++)
|
||||
((volatile uint8_t *)vram)[offset + i] = ((const uint8_t *)value)[i];
|
||||
}
|
||||
|
||||
uint8_t *cs_fixture_vram_host(uint64_t mc)
|
||||
{
|
||||
return mc >= adev->gmc.vram_start && mc <= adev->gmc.vram_end ?
|
||||
|
||||
@@ -47,6 +47,10 @@ struct amdgpu_device;
|
||||
struct amdgpu_device *cs_fixture_adev(void);
|
||||
/* The host memory behind VRAM MC address @mc, or NULL. */
|
||||
uint8_t *cs_fixture_vram_host(uint64_t mc);
|
||||
/* The fixture's read-write view of a driver pointer: one into VRAM (a kernel
|
||||
* VRAM mapping, which the driver reaches only through the aperture, and the
|
||||
* test would fault on) becomes the same bytes of the fixture's VRAM. */
|
||||
void *cs_fixture_host_view(const void *driver_pointer);
|
||||
/* TTM moves VRAM <-> GTT through the upstream code on this device
|
||||
* (ttm_evict_check.c). */
|
||||
void ttm_evict_check(void);
|
||||
|
||||
@@ -560,7 +560,11 @@ int main(void)
|
||||
struct rt_surface *lsurf;
|
||||
struct cs_fixture_stats at_removal, later;
|
||||
struct linuxu_aperture_stats ap0, ap1;
|
||||
static uint8_t aperture[1 << 16];
|
||||
/* The last 64 KiB of VRAM: the driver's view (the no-access
|
||||
* aperture, reached only through it) and the fixture's. */
|
||||
const uint64_t tail = adev->gmc.real_vram_size - (1 << 16);
|
||||
uint8_t *aperture = (uint8_t *)adev->mman.aper_base_kaddr + tail;
|
||||
uint8_t *backing = cs_fixture_vram_host(adev->gmc.vram_start + tail);
|
||||
const struct rt_surface_rect win = { 64, 64, 256, 128 };
|
||||
unsigned long regs;
|
||||
uint32_t lhandle;
|
||||
@@ -573,7 +577,7 @@ int main(void)
|
||||
CHECK(rt_surface_import(pdev, live.segment, 3, live.size, W, H, PITCH, &provider, &lsurf) == 0);
|
||||
lhandle = rt_surface_add(1, lsurf);
|
||||
CHECK(lhandle);
|
||||
linuxu_aperture_set((uintptr_t)aperture, sizeof(aperture));
|
||||
CHECK(backing && linuxu_aperture_contains(aperture, 1 << 16));
|
||||
regs = __atomic_load_n(&dcn401_reg_writes, __ATOMIC_RELAXED);
|
||||
cs_fixture_stats(&at_removal);
|
||||
for (int f = 0; f < 4; f++) {
|
||||
@@ -596,7 +600,7 @@ int main(void)
|
||||
regs = __atomic_load_n(&dcn401_reg_writes, __ATOMIC_RELAXED);
|
||||
cs_fixture_stats(&at_removal);
|
||||
linuxu_aperture_stats(&ap0);
|
||||
memset(aperture, 0x5a, sizeof(aperture));
|
||||
memset(backing, 0x5a, 1 << 16);
|
||||
for (int f = 0; f < 8; f++) {
|
||||
/* DMUB commands and kmap'd VRAM writes go through these. */
|
||||
linuxu_device_memcpy(aperture + 64, &win, sizeof(win));
|
||||
@@ -617,15 +621,14 @@ int main(void)
|
||||
usleep(50000);
|
||||
cs_fixture_stats(&later);
|
||||
linuxu_aperture_stats(&ap1);
|
||||
for (size_t i = 0; i < sizeof(aperture); i++)
|
||||
CHECK(aperture[i] == 0x5a);
|
||||
for (size_t i = 0; i < (1 << 16); i++)
|
||||
CHECK(backing[i] == 0x5a);
|
||||
printf("pipeline: after removal: %lu register writes, %lu SDMA copies, %llu aperture "
|
||||
"operations refused\n", __atomic_load_n(&dcn401_reg_writes, __ATOMIC_RELAXED) - regs,
|
||||
later.copies - at_removal.copies, ap1.skipped - ap0.skipped);
|
||||
CHECK(__atomic_load_n(&dcn401_reg_writes, __ATOMIC_RELAXED) == regs);
|
||||
CHECK(later.copies == at_removal.copies && later.sdma_ibs == at_removal.sdma_ibs);
|
||||
CHECK(ap1.skipped - ap0.skipped >= 17);
|
||||
linuxu_aperture_set(0, 0);
|
||||
rt_removal_end();
|
||||
}
|
||||
|
||||
|
||||
@@ -165,6 +165,7 @@ int main(void)
|
||||
/* The scanout-like destination in VRAM. */
|
||||
CHECK(amdgpu_bo_create_kernel(adev, (uint64_t)DST_PITCH * H, PAGE, AMDGPU_GEM_DOMAIN_VRAM,
|
||||
&dst, &dst_gpu, &dst_cpu) == 0);
|
||||
dst_cpu = cs_fixture_host_view(dst_cpu); /* the test reads VRAM as the GPU wrote it */
|
||||
memset(dst_cpu, 0, (uint64_t)DST_PITCH * H);
|
||||
|
||||
/* The whole frame, pitches differing: one copy per row. */
|
||||
|
||||
@@ -128,7 +128,7 @@ static void check_tt_content(struct amdgpu_bo *bo, uint32_t seed)
|
||||
static void check_window_ptes(struct amdgpu_bo *bo)
|
||||
{
|
||||
const struct ttm_tt *ttm = bo->tbo.ttm;
|
||||
const uint64_t *table = adev->gart.ptr;
|
||||
const uint64_t *table = cs_fixture_host_view(adev->gart.ptr);
|
||||
const uint64_t want = AMDGPU_PTE_VALID | AMDGPU_PTE_SYSTEM | AMDGPU_PTE_READABLE |
|
||||
AMDGPU_PTE_WRITEABLE |
|
||||
(ttm->caching == ttm_cached ? AMDGPU_PTE_SNOOPED : 0);
|
||||
|
||||
@@ -65,8 +65,13 @@
|
||||
},
|
||||
{
|
||||
"flag": "-include rt/device_string.h",
|
||||
"scope": "every DriverKit upstream and linuxu object",
|
||||
"reason": "Replaces memset/memcpy/memmove/memcmp/bzero with scalar volatile routines. Compiler-generated DC ZVA and vector stores fault on BAR0 device memory."
|
||||
"scope": "every DriverKit upstream and linuxu object, and the host library's upstream objects",
|
||||
"reason": "Replaces memset/memcpy/memmove/memcmp/bzero with scalar volatile routines. Compiler-generated DC ZVA and vector stores fault on BAR0 device memory. The routines also send every access to the VRAM aperture through the kernel (rt/aperture.h): a CPU store through a mapping of the BAR to an unplugged GPU panics the Mac. The host library uses the same routines so the CS fixture's no-access aperture catches any direct access offline."
|
||||
},
|
||||
{
|
||||
"flag": "-include rt/dmub_inbox.h",
|
||||
"scope": "build/driver/display/dmub/src/dmub_srv.o and build-dk/driver/display/dmub/src/dmub_srv.o, from drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c",
|
||||
"reason": "dmub_cmd.h's inline dmub_rb_push_front copies a command into the VRAM inbox with a byte loop, and dmub_rb_flush_pending reads it back with READ_ONCE: plain pointer accesses that reached VRAM through a CPU mapping of the BAR, the store that panicked the Mac at a GPU unplug (builds 239 and 240). The header includes dmub_cmd.h first and redirects dmub_srv.c's two calls to the same operations written with dmub_memcpy (as upstream's dmub_rb_out_push_front copies), which reaches VRAM only through the kernel. Ring arithmetic and dmub_cmd.h are unchanged."
|
||||
}
|
||||
],
|
||||
"config_interventions": [
|
||||
|
||||
@@ -29,7 +29,7 @@ cflags=("${hostcflags[@]}" -g -O1 -fsanitize=address,undefined -fno-sanitize=shi
|
||||
-fno-sanitize-recover=all -DFIXTURE_UPSTREAM_KFD_DEVICE
|
||||
-ffunction-sections -fdata-sections "${includes[@]}")
|
||||
amdkfd=third_party/linux/drivers/gpu/drm/amd/amdkfd
|
||||
sources=(linuxu/tests/test_kfd_power.c linuxu/tests/kfd_session_fixture.c
|
||||
sources=(linuxu/tests/test_kfd_power.c linuxu/tests/kfd_session_fixture.c linuxu/src/kmem/device_string.c
|
||||
linuxu/src/amdgpu-rt/power.c linuxu/src/amdgpu-rt/tmpring_gc12.c
|
||||
linuxu/src/amdgpu-rt/kfd_session.c linuxu/src/amdgpu-rt/process_file.c
|
||||
linuxu/src/amdgpu-rt/lx_files.c linuxu/src/amdgpu-rt/lx_frame.c linuxu/src/amdgpu-rt/lx_describe.c linuxu/src/amdgpu-rt/lx_timing.c
|
||||
|
||||
@@ -30,7 +30,7 @@ cflags=("${hostcflags[@]}" -DRT_KFD_COPY_TIMEOUT_MS=200 -DRT_KFD_SETTLE_MS=200
|
||||
-g -O1 -fsanitize=address,undefined -fno-sanitize=shift-base
|
||||
-fno-sanitize-recover=all
|
||||
-ffunction-sections -fdata-sections "${includes[@]}")
|
||||
sources=(linuxu/tests/test_kfd_session.c linuxu/tests/kfd_session_fixture.c
|
||||
sources=(linuxu/tests/test_kfd_session.c linuxu/tests/kfd_session_fixture.c linuxu/src/kmem/device_string.c
|
||||
linuxu/src/amdgpu-rt/tmpring_gc12.c
|
||||
linuxu/src/amdgpu-rt/kfd_session.c linuxu/src/amdgpu-rt/process_file.c
|
||||
linuxu/src/amdgpu-rt/lx_files.c linuxu/src/amdgpu-rt/lx_frame.c linuxu/src/amdgpu-rt/lx_describe.c linuxu/src/amdgpu-rt/lx_timing.c
|
||||
|
||||
@@ -23,7 +23,7 @@ cflags=(-w -std=gnu11 -D__KERNEL__ -include linux/autoconf.h
|
||||
# build the MQD; gfx_v11_0.c / gfx_v12_0.c (through queue_partition_gfx*.c)
|
||||
# provide amdgpu's kernel compute queue MQD builders. Unreferenced upstream
|
||||
# code is stripped.
|
||||
sources=(linuxu/tests/test_queue_partition.c
|
||||
sources=(linuxu/tests/test_queue_partition.c linuxu/src/kmem/device_string.c
|
||||
third_party/linux/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c third_party/linux/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
|
||||
third_party/linux/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v11.c
|
||||
third_party/linux/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v12.c
|
||||
|
||||
Reference in new issue
Block a user