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]
Date:	Tue, 9 Aug 2016 16:30:25 +0200
From:	Joerg Roedel <joro@...tes.org>
To:	Suravee Suthikulpanit <suravee.suthikulpanit@....com>
Cc:	rkrcmar@...hat.com, pbonzini@...hat.com,
	alex.williamson@...hat.com, kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org, sherry.hurwitz@....com
Subject: Re: [PART2 PATCH v5 01/12] iommu/amd: Detect and enable guest vAPIC
 support

On Mon, Jul 25, 2016 at 04:32:00AM -0500, Suthikulpanit, Suravee wrote:
> @@ -2147,10 +2186,16 @@ static int __init early_amd_iommu_init(void)
>  		 * remapping tables.
>  		 */
>  		ret = -ENOMEM;
> -		amd_iommu_irq_cache = kmem_cache_create("irq_remap_cache",
> -				MAX_IRQS_PER_TABLE * sizeof(u32),
> -				IRQ_TABLE_ALIGNMENT,
> -				0, NULL);
> +		if (!AMD_IOMMU_GUEST_IR_GA(amd_iommu_guest_ir))
> +			amd_iommu_irq_cache = kmem_cache_create("irq_remap_cache",
> +					MAX_IRQS_PER_TABLE * sizeof(u32),
> +					IRQ_TABLE_ALIGNMENT,
> +					0, NULL);
> +		else
> +			amd_iommu_irq_cache = kmem_cache_create("irq_remap_cache",
> +					MAX_IRQS_PER_TABLE * (sizeof(u64) * 2),
> +					IRQ_TABLE_ALIGNMENT,
> +					0, NULL);

Its better to calculate only the size-parameter in the if-statement and
make kmem_cache_create use that one.

>  		if (!amd_iommu_irq_cache)
>  			goto out;
>  
> @@ -2403,6 +2448,21 @@ static int __init parse_amd_iommu_dump(char *str)
>  	return 1;
>  }
>  
> +static int __init parse_amd_iommu_intr(char *str)
> +{
> +	for (; *str; ++str) {
> +		if (strncmp(str, "legacy", 6) == 0) {
> +			amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY;
> +			break;
> +		}
> +		if (strncmp(str, "vapic", 5) == 0) {
> +			amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_VAPIC;
> +			break;
> +		}
> +	}
> +	return 1;
> +}
> +
>  static int __init parse_amd_iommu_options(char *str)
>  {
>  	for (; *str; ++str) {
> @@ -2511,6 +2571,7 @@ static int __init parse_ivrs_acpihid(char *str)
>  
>  __setup("amd_iommu_dump",	parse_amd_iommu_dump);
>  __setup("amd_iommu=",		parse_amd_iommu_options);
> +__setup("amd_iommu_intr=",	parse_amd_iommu_intr);

This parameter needs to be documented in Documentation/kernel-parameters.txt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ