[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <754a526e-a6d4-8a3f-0b35-9dd3def5d24b@linux.intel.com>
Date: Thu, 15 Aug 2019 13:01:57 +0800
From: Lu Baolu <baolu.lu@...ux.intel.com>
To: Joerg Roedel <joro@...tes.org>
Cc: baolu.lu@...ux.intel.com, corbet@....net, tony.luck@...el.com,
fenghua.yu@...el.com, tglx@...utronix.de, mingo@...hat.com,
bp@...en8.de, hpa@...or.com, x86@...nel.org,
linux-doc@...r.kernel.org, linux-ia64@...r.kernel.org,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
Thomas.Lendacky@....com, Suravee.Suthikulpanit@....com,
Joerg Roedel <jroedel@...e.de>
Subject: Re: [PATCH 06/10] iommu: Remember when default domain type was set on
kernel command line
Hi,
On 8/14/19 9:38 PM, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@...e.de>
>
> Introduce an extensible concept to remember when certain
> configuration settings for the IOMMU code have been set on
> the kernel command line.
>
> This will be used later to prevent overwriting these
> settings with other defaults.
>
> Signed-off-by: Joerg Roedel <jroedel@...e.de>
> ---
> drivers/iommu/iommu.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index f187e85a074b..e1feb4061b8b 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -32,6 +32,7 @@ static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_IDENTITY;
> static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_DMA;
> #endif
> static bool iommu_dma_strict __read_mostly = true;
> +static u32 iommu_cmd_line __read_mostly;
>
> struct iommu_group {
> struct kobject kobj;
> @@ -68,6 +69,18 @@ static const char * const iommu_group_resv_type_string[] = {
> [IOMMU_RESV_SW_MSI] = "msi",
> };
>
> +#define IOMMU_CMD_LINE_DMA_API (1 << 0)
Prefer BIT() micro?
> +
> +static void iommu_set_cmd_line_dma_api(void)
> +{
> + iommu_cmd_line |= IOMMU_CMD_LINE_DMA_API;
> +}
> +
> +static bool __maybe_unused iommu_cmd_line_dma_api(void)
> +{
> + return !!(iommu_cmd_line & IOMMU_CMD_LINE_DMA_API);
> +}
> +
> #define IOMMU_GROUP_ATTR(_name, _mode, _show, _store) \
> struct iommu_group_attribute iommu_group_attr_##_name = \
> __ATTR(_name, _mode, _show, _store)
> @@ -165,6 +178,8 @@ static int __init iommu_set_def_domain_type(char *str)
> if (ret)
> return ret;
>
> + iommu_set_cmd_line_dma_api();
IOMMU command line is also set in other places, for example,
iommu_setup() (arch/x86/kernel/pci-dma.c). Need to call this there as
well?
Best regards,
Lu Baolu
> +
> iommu_def_domain_type = pt ? IOMMU_DOMAIN_IDENTITY : IOMMU_DOMAIN_DMA;
> return 0;
> }
>
Powered by blists - more mailing lists