On Tue, Nov 07, 2023 at 01:00:00PM -0600, Kalra, Ashish wrote: > > First of all, use the APM bit name here pls: MtrrFixDramModEn. > > > > And then, for the life of me, I can't find any mention in the APM why > > this bit is needed. Neither in "15.36.2 Enabling SEV-SNP" nor in > > "15.34.3 Enabling SEV". > > > > Looking at the bit defintions of WrMem an RdMem - read and write > > requests get directed to system memory instead of MMIO so I guess you > > don't want to be able to write MMIO for certain physical ranges when SNP > > is enabled but it'll be good to have this properly explained instead of > > a "this must happen" information-less sentence. > > This is a per-requisite for SNP_INIT as per the SNP Firmware ABI > specifications, section 8.8.2: Did you even read the text you're responding to? > > This looks backwards. AFAICT, the IOMMU code should call arch code to > > enable SNP at the right time, not the other way around - arch code > > calling driver code. > > > > Especially if the SNP table enablement depends on some exact IOMMU > > init_state: > > > > if (init_state > IOMMU_ENABLED) { > > pr_err("SNP: Too late to enable SNP for IOMMU.\n"); > > > > > > This is again as per SNP_INIT requirements, that SNP support is enabled in > the IOMMU before SNP_INIT is done. The above function snp_rmptable_init() > only calls the IOMMU driver to enable SNP support when it has detected and > enabled platform support for SNP. >v > It is not that IOMMU driver has to call the arch code to enable SNP at the > right time but it is the other way around that once platform support for SNP > is enabled then the IOMMU driver has to be called to enable the same for the > IOMMU and this needs to be done before the CCP driver is loaded and does > SNP_INIT. You again didn't read the text you're responding to. Arch code does not call drivers - arch code sets up the arch and provides facilities which the drivers use. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette