Message ID | 20201028030701.14086-2-j@getutm.app (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | iOS and Apple Silicon host support | expand |
On Tue, Oct 27, 2020 at 08:06:55PM -0700, Joelle van Dyne wrote: > Some hosts (iOS) have a sandboxed filesystem and do not provide low-level > APIs for interfacing with host block devices. > > Signed-off-by: Joelle van Dyne <j@getutm.app> > --- > configure | 4 ++++ > meson.build | 1 + > block/file-posix.c | 8 +++++++- > 3 files changed, 12 insertions(+), 1 deletion(-) A change along these lines is needed in qapi/block-core.json: { 'enum': 'BlockdevDriver', ... { 'name': 'host_device', 'if': 'defined(CONFIG_HOST_BLOCK_DEVICE)' } That way the QAPI schema reflects the QEMU binary's actual features. > > diff --git a/configure b/configure > index 71bbe82ac5..4e68a5fefe 100755 > --- a/configure > +++ b/configure > @@ -448,6 +448,7 @@ ninja="" > skip_meson=no > gettext="" > mirror_jit="no" > +host_block_device_support="yes" > > bogus_os="no" > malloc_trim="auto" > @@ -5901,6 +5902,9 @@ if test "$default_devices" = "yes" ; then > else > echo "CONFIG_MINIKCONF_MODE=--allnoconfig" >> $config_host_mak > fi > +if test "$host_block_device_support" = "yes" ; then > + echo "CONFIG_HOST_BLOCK_DEVICE=y" >> $config_host_mak > +fi > if test "$debug_tcg" = "yes" ; then > echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak > fi How do you disable CONFIG_HOST_BLOCK_DEVICE? There is no ./configure --disable-host-block-device option.
On Wed, Oct 28, 2020 at 4:22 AM Stefan Hajnoczi <stefanha@gmail.com> wrote: > > On Tue, Oct 27, 2020 at 08:06:55PM -0700, Joelle van Dyne wrote: > > Some hosts (iOS) have a sandboxed filesystem and do not provide low-level > > APIs for interfacing with host block devices. > > > > Signed-off-by: Joelle van Dyne <j@getutm.app> > > --- > > configure | 4 ++++ > > meson.build | 1 + > > block/file-posix.c | 8 +++++++- > > 3 files changed, 12 insertions(+), 1 deletion(-) > > A change along these lines is needed in qapi/block-core.json: > > { 'enum': 'BlockdevDriver', > ... > { 'name': 'host_device', 'if': 'defined(CONFIG_HOST_BLOCK_DEVICE)' } > > That way the QAPI schema reflects the QEMU binary's actual features. Will do. > > > > > diff --git a/configure b/configure > > index 71bbe82ac5..4e68a5fefe 100755 > > --- a/configure > > +++ b/configure > > @@ -448,6 +448,7 @@ ninja="" > > skip_meson=no > > gettext="" > > mirror_jit="no" > > +host_block_device_support="yes" > > > > bogus_os="no" > > malloc_trim="auto" > > @@ -5901,6 +5902,9 @@ if test "$default_devices" = "yes" ; then > > else > > echo "CONFIG_MINIKCONF_MODE=--allnoconfig" >> $config_host_mak > > fi > > +if test "$host_block_device_support" = "yes" ; then > > + echo "CONFIG_HOST_BLOCK_DEVICE=y" >> $config_host_mak > > +fi > > if test "$debug_tcg" = "yes" ; then > > echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak > > fi > > How do you disable CONFIG_HOST_BLOCK_DEVICE? There is no ./configure > --disable-host-block-device option. I don't see a value in disabling as an option. It's always enabled by default and automatically disabled for iOS. -j
diff --git a/configure b/configure index 71bbe82ac5..4e68a5fefe 100755 --- a/configure +++ b/configure @@ -448,6 +448,7 @@ ninja="" skip_meson=no gettext="" mirror_jit="no" +host_block_device_support="yes" bogus_os="no" malloc_trim="auto" @@ -5901,6 +5902,9 @@ if test "$default_devices" = "yes" ; then else echo "CONFIG_MINIKCONF_MODE=--allnoconfig" >> $config_host_mak fi +if test "$host_block_device_support" = "yes" ; then + echo "CONFIG_HOST_BLOCK_DEVICE=y" >> $config_host_mak +fi if test "$debug_tcg" = "yes" ; then echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak fi diff --git a/meson.build b/meson.build index 0a56fef146..e880274b7c 100644 --- a/meson.build +++ b/meson.build @@ -2149,6 +2149,7 @@ summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')} summary_info += {'qed support': config_host.has_key('CONFIG_QED')} summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')} summary_info += {'sheepdog support': config_host.has_key('CONFIG_SHEEPDOG')} +summary_info += {'host block dev support': config_host.has_key('CONFIG_HOST_BLOCK_DEVICE')} summary_info += {'capstone': capstone_opt == 'disabled' ? false : capstone_opt} summary_info += {'libpmem support': config_host.has_key('CONFIG_LIBPMEM')} summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')} diff --git a/block/file-posix.c b/block/file-posix.c index c63926d592..52f7c20525 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -41,7 +41,7 @@ #include "scsi/pr-manager.h" #include "scsi/constants.h" -#if defined(__APPLE__) && (__MACH__) +#if defined(CONFIG_HOST_BLOCK_DEVICE) && defined(__APPLE__) && (__MACH__) #include <paths.h> #include <sys/param.h> #include <IOKit/IOKitLib.h> @@ -3247,6 +3247,8 @@ BlockDriver bdrv_file = { /***********************************************/ /* host device */ +#if defined(CONFIG_HOST_BLOCK_DEVICE) + #if defined(__APPLE__) && defined(__MACH__) static kern_return_t GetBSDPath(io_iterator_t mediaIterator, char *bsdPath, CFIndex maxPathSize, int flags); @@ -3872,6 +3874,8 @@ static BlockDriver bdrv_host_cdrom = { }; #endif /* __FreeBSD__ */ +#endif /* CONFIG_HOST_BLOCK_DEVICE */ + static void bdrv_file_init(void) { /* @@ -3879,6 +3883,7 @@ static void bdrv_file_init(void) * registered last will get probed first. */ bdrv_register(&bdrv_file); +#if defined(CONFIG_HOST_BLOCK_DEVICE) bdrv_register(&bdrv_host_device); #ifdef __linux__ bdrv_register(&bdrv_host_cdrom); @@ -3886,6 +3891,7 @@ static void bdrv_file_init(void) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) bdrv_register(&bdrv_host_cdrom); #endif +#endif /* CONFIG_HOST_BLOCK_DEVICE */ } block_init(bdrv_file_init);
Some hosts (iOS) have a sandboxed filesystem and do not provide low-level APIs for interfacing with host block devices. Signed-off-by: Joelle van Dyne <j@getutm.app> --- configure | 4 ++++ meson.build | 1 + block/file-posix.c | 8 +++++++- 3 files changed, 12 insertions(+), 1 deletion(-)