lkml.org 
[lkml]   [2020]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.
On Tue, Jan 21, 2020 at 03:54:03PM -0500, Konrad Rzeszutek Wilk wrote:
> >
> > Additional memory calculations based on # of PCI devices and
> > their memory ranges will make it more complicated with so
> > many other permutations and combinations to explore, it is
> > essential to keep this patch as simple as possible by
> > adjusting the bounce buffer size simply by determining it
> > from the amount of provisioned guest memory.
>>
>> Please rework the patch to:
>>
>> - Use a log solution instead of the multiplication.
>> Feel free to cap it at a sensible value.

Ok.

>>
>> - Also the code depends on SWIOTLB calling in to the
>> adjust_swiotlb_default_size which looks wrong.
>>
>> You should not adjust io_tlb_nslabs from swiotlb_size_or_default.

>> That function's purpose is to report a value.
>>
>> - Make io_tlb_nslabs be visible outside of the SWIOTLB code.
>>
>> - Can you utilize the IOMMU_INIT APIs and have your own detect which would
>> modify the io_tlb_nslabs (and set swiotbl=1?).

This seems to be a nice option, but then IOMMU_INIT APIs are
x86-specific and this swiotlb buffer size adjustment is also needed
for other memory encryption architectures like Power, S390, etc.

>>
>> Actually you seem to be piggybacking on pci_swiotlb_detect_4gb - so
>> perhaps add in this code ? Albeit it really should be in it's own
>> file, not in arch/x86/kernel/pci-swiotlb.c

Actually, we piggyback on pci_swiotlb_detect_override which sets
swiotlb=1 as x86_64_start_kernel() and invocation of sme_early_init()
forces swiotlb on, but again this is all x86 architecture specific.

Thanks,
Ashish

\
 
 \ /
  Last update: 2020-01-25 00:01    [W:0.114 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site