Thanks Max, I've written a frontend pseudo HBA driver which will expose disks through scsi_probe. The requirement is to pass SGL's to a SCSI target driver sitting in a backend Virtual Machine, using memory sharing between VMs. The backend VM copies these SGL's into its own SGL's before doing an I/O. I'll then instead use hat_getpfnum to get the page address for each buffer and construct my own DMA windows from the bp?? Or if you think there's a better way to do this pls let me know.
Regards, Bhaskar. -----Original Message----- From: m...@bruningsystems.com [mailto:m...@bruningsystems.com] Sent: Friday, November 13, 2009 4:53 PM To: Jayaraman, Bhaskar Cc: opensolaris-code@opensolaris.org Subject: Re: [osol-code] DDI_DMA_BADATTR error! Hi Bhaskar, When you use ddi_dma_alloc_handle() with a pseudo device, the routine calls into the pseudonex.c module. The pseudonex module routine for ddi_dma_alloc_handle calls is ddi_no_dma_allochdl(), which returns DDI_DMA_BADATTR (see the code in pseudonex.c and sunddi.c). max Jayaraman, Bhaskar wrote: > Max yes I'm assigning smu_generic_dma_attr to tmp_dma_attr before making the > call. I've tried a bunch of things like changing the attributes but I still > keep getting the error. Would switching to DDI_DMA_FORCE_PHYSICAL be advised? > Since I'm writing this driver for a pseudo device I'm sure IOMMU virtual > addresses won't be used. > Bhaskar. > > -----Original Message----- > From: m...@bruningsystems.com [mailto:m...@bruningsystems.com] > Sent: Friday, November 13, 2009 4:01 PM > To: Jayaraman, Bhaskar > Cc: opensolaris-code@opensolaris.org > Subject: Re: [osol-code] DDI_DMA_BADATTR error! > > Hi Bhaskar, > > Jayaraman, Bhaskar wrote: > >> Hi I'm using an x86 vm which has an emulated IOMMU on it. The following are >> the attributes that I'm passing to ddi_dma_alloc_handle >> >> static ddi_dma_attr_t smu_generic_dma_attr = { >> DMA_ATTR_V0, /* dma_attr_version >> */ >> (unsigned long long)0, /* low DMA address >> range */ >> (unsigned long long)0xffffffff, /* high DMA address range */ >> (unsigned long long)0xffffffff, /* DMA counter register */ >> 8, /* DMA address alignment */ >> 0x07, /* DMA burstsizes */ >> 1, /* min DMA size */ >> (unsigned long long)0xffffffff, /* max DMA size */ >> (unsigned long long)0xffffffff, /* segment boundary */ >> 16, /* dma_attr_sglen */ >> 512, /* granularity of device */ >> 0 /* bus specific DMA flags */ >> }; >> >> The call I make is ddi_dma_alloc_handle (instance->dip, &tmp_dma_attr, >> DDI_DMA_DONTWAIT, 0, &acmd->cmd_dmahandle) >> >> > I assume you are assigning tmp_dma_attr to smu_generic_dma_attr before > making this call? What happens if you pass &smu_generic_dma_attr instead > of &tmp_dma_attr? > > max > > >> In the 3rd parameter, I've tried using DDI_DMA_SLEEP as well but I still get >> the DDI_DMA_BADATTR error from the API. >> >> I don't see where I'm going wrong in making the call. >> >> Regards, >> Bhaskar. >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> opensolaris-code mailing list >> opensolaris-code@opensolaris.org >> http://mail.opensolaris.org/mailman/listinfo/opensolaris-code >> >> > > > _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code