diff --git a/.gitignore b/.gitignore index 1b48e65..27f269a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ /hv_fcopy_daemon.c /lsvmbus /bondvf.sh +/hv_fcopy_uio_daemon.c +/vmbus_bufring.c +/vmbus_bufring.h diff --git a/hyperv-daemons.spec b/hyperv-daemons.spec index 08337d1..ce596eb 100644 --- a/hyperv-daemons.spec +++ b/hyperv-daemons.spec @@ -2,6 +2,8 @@ %global hv_kvp_daemon hypervkvpd # Hyper-V VSS daemon binary name %global hv_vss_daemon hypervvssd +# Hyper-V FCOPY daemon binary name +%global hv_fcopy_uio_daemon hv_fcopy_uio_daemon # snapshot version %global snapver .20220731git # use hardened build @@ -11,7 +13,7 @@ Name: hyperv-daemons Version: 0 -Release: 0.46%{?snapver}%{?dist} +Release: 0.47%{?snapver}%{?dist} Summary: Hyper-V daemons suite License: GPL-2.0-only @@ -34,7 +36,12 @@ Source100: hv_vss_daemon.c Source101: hypervvssd.service Source102: hypervvss.rules - +# HYPERV FCOPY UIO DAEMON +# source taken from https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/snapshot/linux-6.10-rc5.tar.gz +Source200: hv_fcopy_uio_daemon.c +Source201: hypervfcopyd.service +Source202: vmbus_bufring.c +Source203: vmbus_bufring.h # HYPERV TOOLS Source301: lsvmbus @@ -82,6 +89,13 @@ ExclusiveArch: i686 x86_64 aarch64 Requires: hypervkvpd = %{version}-%{release} Requires: hypervvssd = %{version}-%{release} + +# FCopy UIO driver does not seem to be supported on arm +%ifnarch aarch64 +Requires: hypervfcopyd = %{version}-%{release} +%else +Obsoletes: hypervfcopyd <= %{version}-%{release} +%endif BuildRequires: gcc %description @@ -121,6 +135,23 @@ kernel driver. After this is done it waits for instructions from Windows Host if to "freeze" or "thaw" the filesystem on the Linux Guest. +%ifnarch aarch64 +# FCOPY UIO driver does not seem to be saupported on arm etc. +%package -n hypervfcopyd +Summary: Hyper-V FCOPY UIO daemon +Requires: %{name}-license = %{version}-%{release} +BuildRequires: systemd, kernel-headers +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd + +%description -n hypervfcopyd +Hypervfcopyd is an implementation of file copy service functionality +for Linux Guest running on Hyper-V. The daemon enables host to copy +a file (over VMBUS) into the Linux Guest. The daemon first registers +with the kernel driver. After this is done it waits for instructions +from Windows Host. +%endif %package license Summary: License of the Hyper-V daemons suite @@ -146,6 +177,11 @@ cp -pvL %{SOURCE3} hv_get_dns_info.sh cp -pvL %{SOURCE4} hv_set_ifconfig.sh cp -pvL %{SOURCE100} hv_vss_daemon.c +%ifnarch aarch64 +cp -pvL %{SOURCE200} hv_fcopy_uio_daemon.c +cp -pvL %{SOURCE202} vmbus_bufring.c +cp -pvL %{SOURCE203} vmbus_bufring.h +%endif cp -pvL %{SOURCE301} lsvmbus %autopatch -p1 @@ -160,16 +196,31 @@ cp -pvL %{SOURCE301} lsvmbus %{__cc} $RPM_LD_FLAGS hv_vss_daemon.o -o %{hv_vss_daemon} +%ifnarch aarch64 +# HYPERV FCOPY UIO DAEMON +%{__cc} $RPM_OPT_FLAGS -c hv_fcopy_uio_daemon.c +%{__cc} $RPM_OPT_FLAGS -c vmbus_bufring.c +%{__cc} $RPM_LD_FLAGS vmbus_bufring.o hv_fcopy_uio_daemon.o -o %{hv_fcopy_uio_daemon} +%endif + %install rm -rf %{buildroot} mkdir -p %{buildroot}%{_sbindir} install -p -m 0755 %{hv_kvp_daemon} %{buildroot}%{_sbindir} install -p -m 0755 %{hv_vss_daemon} %{buildroot}%{_sbindir} + +%ifnarch aarch64 +install -p -m 0755 %{hv_fcopy_uio_daemon} %{buildroot}%{_sbindir} +%endif + # Systemd unit file mkdir -p %{buildroot}%{_unitdir} install -p -m 0644 %{SOURCE5} %{buildroot}%{_unitdir} install -p -m 0644 %{SOURCE101} %{buildroot}%{_unitdir} +%ifnarch aarch64 +install -p -m 0644 %{SOURCE201} %{buildroot}%{_unitdir} +%endif # Udev rules mkdir -p %{buildroot}%{_udevrulesdir} install -p -m 0644 %{SOURCE6} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hypervkvp.rules @@ -217,6 +268,19 @@ fi %preun -n hypervvssd %systemd_preun hypervvssd.service +%ifnarch aarch64 +%post -n hypervfcopyd +if [ $1 -gt 1 ] ; then + # Upgrade + systemctl --no-reload disable hypervfcopyd.service >/dev/null 2>&1 || : +fi + +%postun -n hypervfcopyd +%systemd_postun hypervfcopyd.service + +%preun -n hypervfcopyd +%systemd_preun hypervfcopyd.service +%endif %files # the base package does not contain any files. @@ -234,6 +298,12 @@ fi %{_unitdir}/hypervvssd.service %{_udevrulesdir}/%{udev_prefix}-hypervvss.rules +%ifnarch aarch64 +%files -n hypervfcopyd +%{_sbindir}/%{hv_fcopy_uio_daemon} +%{_unitdir}/hypervfcopyd.service +%endif + %files license %doc COPYING @@ -242,6 +312,13 @@ fi %{_sbindir}/vmbus_testing %changelog +* Fri Jul 12 2024 Miroslav Rezanina - 0-0.47.20220731git +- hpvd-Add-support-for-newer-fcopy-UIO-hyperv-daemons-modul.patch [RHEL-44617] +- hpvd-Update-main-package-dep-on-hypervfcopyd-to-be-arch-d.patch [RHEL-44617] +- hpvd-Particularize-hypervfcopyd-service-requirements.patch [RHEL-44617] +- Resolves: RHEL-44617 + ([RHEL-10] Add support for fcopy UIO userland module in hyperv-daemons) + * Thu Jun 27 2024 Miroslav Rezanina - 0-0.46.20220731git - hpvd-Add-support-for-patching-hyperv-daemons.patch [RHEL-40107 RHEL-40679] - hpvd-Do-not-set-NM_CONTROLLED-no.patch [RHEL-40107 RHEL-40679] diff --git a/hypervfcopyd.service b/hypervfcopyd.service new file mode 100644 index 0000000..57bf3da --- /dev/null +++ b/hypervfcopyd.service @@ -0,0 +1,11 @@ +[Unit] +Description=Hyper-V FCOPY UIO daemon +ConditionPathExists=/sys/bus/vmbus/devices/eb765408-105f-49b6-b4aa-c123b64d17d4/ +IgnoreOnIsolate=1 + +[Service] +ExecStartPre=/bin/sh -c '[ ! -d /sys/bus/vmbus/devices/eb765408-105f-49b6-b4aa-c123b64d17d4/uio ] && modprobe uio_hv_generic && echo 34d14be3-dee4-41c8-9ae7-6b174977c192 > /sys/bus/vmbus/drivers/uio_hv_generic/new_id ||:' +ExecStart=/usr/sbin/hv_fcopy_uio_daemon -n + +[Install] +WantedBy=multi-user.target diff --git a/sources b/sources index d3caf80..dc31f83 100644 --- a/sources +++ b/sources @@ -5,3 +5,6 @@ SHA512 (hv_set_ifconfig.sh) = 3dea16ca48ba9732e6dc0095d35c052cbf4664ba905ca492c0 SHA512 (hv_vss_daemon.c) = 940ab279e706dc13438849253d59e58af9710c55fcd2a879715ccc59accfa0cc68e2299c5ec95fde82dd1d7baf0fb0c49d56c3cdf4a4a2c95e8685528497ea8b SHA512 (COPYING) = fbb1e0f29741e900a81ccbe76102103365423d310e9987dfc5858174999911037a9ad48270a3d0b86f245e91868ed73813ca273584be43816f53517858f3aabd SHA512 (lsvmbus) = 43be38dd1ef8b2864a3f37a29a440478a69879ea4882a7ded8e42c2464b7325c1b0da3c7e001154da5f892641b6f60d75e7dbab287a9e9cfcf9567ea9eeec8e0 +SHA512 (hv_fcopy_uio_daemon.c) = 72828ef81758df0a2f7140b1b28fc2740c259046f8c0c006f2790cdc98a07e5c6370248eb25a5dbf5583306c4b5c80fd2fd38baab6d2e2b4b2211e5ab82afebc +SHA512 (vmbus_bufring.c) = c471ed3aec5b77e1d8067566153ccdb8efeac2576e44b96facf998e38fc21500137dd4272c29e436f78107fd2eabddbd133c7049c797bf3772be824db9ba756a +SHA512 (vmbus_bufring.h) = 73b6b12fe94c47c15a8504f8fb2a900d89f2b0cfb2f4fe79ae331783b2aaea78f78c117247b0f163ad34e8f792776f2f2854352c7483070cbc5e5a7ab6b91a02