Re: [PART2 PATCH v5 01/12] iommu/amd: Detect and enable guest vAPIC support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux