mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 04:43:53 +00:00
xen/blkback: do not use x86 CPUID in generic code
Move checker for whether Xen creates IOMMU mappings for foreign pages
into a helper that's defined in arch-specific code.
Reported by: Elliott Mitchell <ehem+freebsd@m5p.com>
Fixes: 1d528f95e8
('xen/blkback: remove bounce buffering mode')
Sponsored by: Citrix Systems R&D
This commit is contained in:
parent
2049cc3218
commit
091febc04a
|
@ -80,7 +80,6 @@ __FBSDID("$FreeBSD$");
|
|||
#include <xen/gnttab.h>
|
||||
#include <xen/xen_intr.h>
|
||||
|
||||
#include <contrib/xen/arch-x86/cpuid.h>
|
||||
#include <contrib/xen/event_channel.h>
|
||||
#include <contrib/xen/grant_table.h>
|
||||
|
||||
|
@ -3318,16 +3317,12 @@ xbb_attach_failed(struct xbb_softc *xbb, int err, const char *fmt, ...)
|
|||
static int
|
||||
xbb_probe(device_t dev)
|
||||
{
|
||||
uint32_t regs[4];
|
||||
|
||||
if (strcmp(xenbus_get_type(dev), "vbd"))
|
||||
return (ENXIO);
|
||||
|
||||
KASSERT(xen_cpuid_base != 0, ("Invalid base Xen CPUID leaf"));
|
||||
cpuid_count(xen_cpuid_base + 4, 0, regs);
|
||||
|
||||
/* Only attach if Xen creates IOMMU entries for grant mapped pages. */
|
||||
if (!(regs[0] & XEN_HVM_CPUID_IOMMU_MAPPINGS)) {
|
||||
if (!xen_has_iommu_maps()) {
|
||||
static bool warned;
|
||||
|
||||
if (!warned) {
|
||||
|
|
|
@ -72,6 +72,8 @@ xen_pv_nics_disabled(void)
|
|||
return (xen_hvm_domain() && xen_disable_pv_nics != 0);
|
||||
}
|
||||
|
||||
bool xen_has_iommu_maps(void);
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif /* _MACHINE_X86_XEN_XEN_OS_H_ */
|
||||
|
|
|
@ -489,3 +489,14 @@ xen_hvm_cpu_init(void)
|
|||
DPCPU_SET(vcpu_info, vcpu_info);
|
||||
}
|
||||
SYSINIT(xen_hvm_cpu_init, SI_SUB_INTR, SI_ORDER_FIRST, xen_hvm_cpu_init, NULL);
|
||||
|
||||
bool
|
||||
xen_has_iommu_maps(void)
|
||||
{
|
||||
uint32_t regs[4];
|
||||
|
||||
KASSERT(xen_cpuid_base != 0, ("Invalid base Xen CPUID leaf"));
|
||||
cpuid_count(xen_cpuid_base + 4, 0, regs);
|
||||
|
||||
return (regs[0] & XEN_HVM_CPUID_IOMMU_MAPPINGS);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue