Skip to contentSkip to conversation

accel/amdxdna: Block running under a hypervisor

PATCH In review Mario Limonciello (AMD) 2 participants 3 messages Dec 13, 2025 – Dec 15, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 accel/amdxdna: Block running under a hypervisor

SVA support is required, which isn't configured by hypervisor solutions.

---
 drivers/accel/amdxdna/aie2_pci.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/accel/amdxdna/aie2_pci.c +6 -0
index ceef1c502e9e2..d892b412e4c0e 100644
@@ -17,6 +17,7 @@
 #include <linux/iopoll.h>
 #include <linux/pci.h>
 #include <linux/xarray.h>
+#include <asm/hypervisor.h>
 
 #include "aie2_msg_priv.h"
 #include "aie2_pci.h"
@@ -508,6 +509,11 @@ static int aie2_init(struct amdxdna_dev *xdna)
 	unsigned long bars = 0;
 	int i, nvec, ret;
 
+	if (!hypervisor_is_type(X86_HYPER_NATIVE)) {
+		XDNA_ERR(xdna, "Running under hypervisor not supported");
+		return -EINVAL;
+	}
+
 	ndev = drmm_kzalloc(&xdna->ddev, sizeof(*ndev), GFP_KERNEL);
 	if (!ndev)
 		return -ENOMEM;
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Mario Limonciello (AMD)

SVA support is required, which isn't configured by hypervisor solutions.

I think it is because aie2 can not load firmware in hypervisor solutions.

Lizhi

Quoted 32 lines
---
  drivers/accel/amdxdna/aie2_pci.c | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/accel/amdxdna/aie2_pci.c +6 -0
index ceef1c502e9e2..d892b412e4c0e 100644
@@ -17,6 +17,7 @@
  #include <linux/iopoll.h>
  #include <linux/pci.h>
  #include <linux/xarray.h>
+#include <asm/hypervisor.h>
 
  #include "aie2_msg_priv.h"
  #include "aie2_pci.h"
@@ -508,6 +509,11 @@ static int aie2_init(struct amdxdna_dev *xdna)
  	unsigned long bars = 0;
  	int i, nvec, ret;
 
+	if (!hypervisor_is_type(X86_HYPER_NATIVE)) {
+		XDNA_ERR(xdna, "Running under hypervisor not supported");
+		return -EINVAL;
+	}
+
  	ndev = drmm_kzalloc(&xdna->ddev, sizeof(*ndev), GFP_KERNEL);
  	if (!ndev)
  		return -ENOMEM;
#2 lore raw
Quoted 8 lines · Lizhi Hou
Quoted 2 lines · Mario Limonciello (AMD)

SVA support is required, which isn't configured by hypervisor solutions.

I think it is because aie2 can not load firmware in hypervisor solutions.

Thanks. Pushed to drm-misc-fixes.

7bbf6d15e935a accel/amdxdna: Block running under a hypervisor

Quoted 33 lines

Lizhi

Quoted 30 lines

---
  drivers/accel/amdxdna/aie2_pci.c | 6 ++++++

  1 file changed, 6 insertions(+)
drivers/accel/amdxdna/aie2_pci.c +6 -0
index ceef1c502e9e2..d892b412e4c0e 100644
@@ -17,6 +17,7 @@
   #include <linux/iopoll.h>
   #include <linux/pci.h>
   #include <linux/xarray.h>
+#include <asm/hypervisor.h>
   #include "aie2_msg_priv.h"
   #include "aie2_pci.h"
@@ -508,6 +509,11 @@ static int aie2_init(struct amdxdna_dev *xdna)
       unsigned long bars = 0;
       int i, nvec, ret;
+    if (!hypervisor_is_type(X86_HYPER_NATIVE)) {
+        XDNA_ERR(xdna, "Running under hypervisor not supported");
+        return -EINVAL;
+    }
+
       ndev = drmm_kzalloc(&xdna->ddev, sizeof(*ndev), GFP_KERNEL);
       if (!ndev)
           return -ENOMEM;