lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231205145304.GE2787277@nvidia.com>
Date:   Tue, 5 Dec 2023 10:53:04 -0400
From:   Jason Gunthorpe <jgg@...dia.com>
To:     Yan Zhao <yan.y.zhao@...el.com>
Cc:     iommu@...ts.linux.dev, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, alex.williamson@...hat.com,
        pbonzini@...hat.com, seanjc@...gle.com, joro@...tes.org,
        will@...nel.org, robin.murphy@....com, kevin.tian@...el.com,
        baolu.lu@...ux.intel.com, dwmw2@...radead.org, yi.l.liu@...el.com
Subject: Re: [RFC PATCH 12/42] iommufd: Introduce allocation data info and
 flag for KVM managed HWPT

On Tue, Dec 05, 2023 at 03:08:03PM +0800, Yan Zhao wrote:
> On Mon, Dec 04, 2023 at 02:29:28PM -0400, Jason Gunthorpe wrote:
> > On Sat, Dec 02, 2023 at 05:21:13PM +0800, Yan Zhao wrote:
> > 
> > > @@ -413,11 +422,13 @@ struct iommu_hwpt_arm_smmuv3 {
> > >   * @IOMMU_HWPT_DATA_NONE: no data
> > >   * @IOMMU_HWPT_DATA_VTD_S1: Intel VT-d stage-1 page table
> > >   * @IOMMU_HWPT_DATA_ARM_SMMUV3: ARM SMMUv3 Context Descriptor Table
> > > + * @IOMMU_HWPT_DATA_KVM: KVM managed stage-2 page table
> > >   */
> > >  enum iommu_hwpt_data_type {
> > >  	IOMMU_HWPT_DATA_NONE,
> > >  	IOMMU_HWPT_DATA_VTD_S1,
> > >  	IOMMU_HWPT_DATA_ARM_SMMUV3,
> > > +	IOMMU_HWPT_DATA_KVM,
> > >  };
> > 
> > Definately no, the HWPT_DATA is for the *driver* - it should not be
> > "kvm".
> > 
> > Add the kvm fd to the main structure
> >
> Do you mean add a "int kvm_fd" to "struct iommu_hwpt_alloc" ?
> struct iommu_hwpt_alloc {
>         __u32 size;
>         __u32 flags;
>         __u32 dev_id;
>         __u32 pt_id;
>         __u32 out_hwpt_id;
>         __u32 __reserved;
>         __u32 data_type;
>         __u32 data_len;
>         __aligned_u64 data_uptr;
> };
> 
> Then always create the HWPT as IOMMUFD_OBJ_HWPT_KVM as long as kvm_fd > 0 ?

Yes, but 0 is a valid FD so you need to add a flag 'kvm_fd valid'

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ