return rc;
}
- rc = dom0_setup_permissions(d);
- if ( rc )
- {
- panic("Unable to setup Dom0 permissions: %d\n", rc);
- return rc;
- }
-
update_domain_wallclock_time(d);
v->is_initialised = 1;
printk(XENLOG_INFO "*** Building a PVH Dom%d ***\n", d->domain_id);
+ if ( is_hardware_domain(d) )
+ {
+ /*
+ * Setup permissions early so that calls to add MMIO regions to the
+ * p2m as part of vPCI setup don't fail due to permission checks.
+ */
+ rc = dom0_setup_permissions(d);
+ if ( rc )
+ {
+ printk("%pd unable to setup permissions: %d\n", d, rc);
+ return rc;
+ }
+ }
+
/*
* NB: MMCFG initialization needs to be performed before iommu
* initialization so the iommu code can fetch the MMCFG regions used by the
* License along with this program; If not, see <http://www.gnu.org/licenses/>.
*/
+#include <xen/iocap.h>
#include <xen/sched.h>
#include <xen/softirq.h>
#include <xen/vpci.h>
+#include <xsm/xsm.h>
+
#include <asm/event.h>
#include <asm/p2m.h>
{
unsigned long size = e - s + 1;
+ if ( !iomem_access_permitted(map->d, s, e) )
+ {
+ printk(XENLOG_G_WARNING
+ "%pd denied access to MMIO range [%#lx, %#lx]\n",
+ map->d, s, e);
+ return -EPERM;
+ }
+
+ rc = xsm_iomem_mapping(XSM_HOOK, map->d, s, e, map->map);
+ if ( rc )
+ {
+ printk(XENLOG_G_WARNING
+ "%pd XSM denied access to MMIO range [%#lx, %#lx]: %d\n",
+ map->d, s, e, rc);
+ return rc;
+ }
+
/*
* ARM TODOs:
* - On ARM whether the memory is prefetchable or not should be passed