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]
Message-ID: <20150512090053.GH4561@localhost.localdomain>
Date:	Tue, 12 May 2015 17:00:53 +0800
From:	Dave Young <dyoung@...hat.com>
To:	"Li, Zhen-Hua" <zhen-hual@...com>
Cc:	dwmw2@...radead.org, indou.takao@...fujitsu.com, bhe@...hat.com,
	joro@...tes.org, vgoyal@...hat.com,
	iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
	linux-pci@...r.kernel.org, kexec@...ts.infradead.org,
	alex.williamson@...hat.com, ddutile@...hat.com,
	ishii.hironobu@...fujitsu.com, bhelgaas@...gle.com,
	doug.hatch@...com, jerry.hoemann@...com, tom.vaden@...com,
	li.zhang6@...com, lisa.mitchell@...com, billsumnerlinux@...il.com,
	rwright@...com
Subject: Re: [PATCH v11 09/10] iommu/vt-d: Copy functions for irte

On 05/11/15 at 05:52pm, Li, Zhen-Hua wrote:
> Functions to copy the irte data from the old kernel into the kdump kernel.

Use above line as subject is better, if irte means interrupt remappin table
entry then descripbe it then I like the long format in subject line.

Also it need a better patch description about why do we need this, and what
has been added in this patch.

> 
> Signed-off-by: Li, Zhen-Hua <zhen-hual@...com>
> ---
>  drivers/iommu/intel_irq_remapping.c | 68 +++++++++++++++++++++++++++++++++++++
>  include/linux/intel-iommu.h         |  4 +++
>  2 files changed, 72 insertions(+)
> 
> diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
> index 5709ae9..c2a4406 100644
> --- a/drivers/iommu/intel_irq_remapping.c
> +++ b/drivers/iommu/intel_irq_remapping.c
> @@ -17,6 +17,10 @@
>  
>  #include "irq_remapping.h"
>  
> +static int __iommu_load_old_irte(struct intel_iommu *iommu);
> +static int __iommu_update_old_irte(struct intel_iommu *iommu, int index);
> +static void iommu_check_pre_ir_status(struct intel_iommu *iommu);
> +
>  struct ioapic_scope {
>  	struct intel_iommu *iommu;
>  	unsigned int id;
> @@ -1299,3 +1303,67 @@ int dmar_ir_hotplug(struct dmar_drhd_unit *dmaru, bool insert)
>  
>  	return ret;
>  }
> +
> +static int __iommu_load_old_irte(struct intel_iommu *iommu)
> +{
> +	if ((!iommu)
> +		|| (!iommu->ir_table)
> +		|| (!iommu->ir_table->base)
> +		|| (!iommu->ir_table->base_old_phys)
> +		|| (!iommu->ir_table->base_old_virt))
> +		return -1;
> +
> +	memcpy(iommu->ir_table->base,
> +		iommu->ir_table->base_old_virt,
> +		INTR_REMAP_TABLE_ENTRIES*sizeof(struct irte));
> +
> +	__iommu_flush_cache(iommu, iommu->ir_table->base,
> +		INTR_REMAP_TABLE_ENTRIES*sizeof(struct irte));
> +
> +	return 0;
> +}
> +
> +static int __iommu_update_old_irte(struct intel_iommu *iommu, int index)
> +{
> +	int start;
> +	unsigned long size;
> +	void __iomem *to;
> +	void *from;
> +
> +	if ((!iommu)
> +		|| (!iommu->ir_table)
> +		|| (!iommu->ir_table->base)
> +		|| (!iommu->ir_table->base_old_phys)
> +		|| (!iommu->ir_table->base_old_virt))
> +		return -1;
> +
> +	if (index < -1 || index >= INTR_REMAP_TABLE_ENTRIES)
> +		return -1;
> +
> +	if (index == -1) {
> +		start = 0;
> +		size = INTR_REMAP_TABLE_ENTRIES * sizeof(struct irte);
> +	} else {
> +		start = index * sizeof(struct irte);
> +		size = sizeof(struct irte);
> +	}
> +
> +	to = iommu->ir_table->base_old_virt;
> +	from = iommu->ir_table->base;
> +	memcpy(to + start, from + start, size);
> +
> +	__iommu_flush_cache(iommu, to + start, size);
> +
> +	return 0;
> +}
> +
> +static void iommu_check_pre_ir_status(struct intel_iommu *iommu)
> +{
> +	u32 sts;
> +
> +	sts = readl(iommu->reg + DMAR_GSTS_REG);
> +	if (sts & DMA_GSTS_IRES) {
> +		pr_info("IR is enabled prior to OS.\n");
> +		iommu->pre_enabled_ir = 1;
> +	}
> +}
> diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
> index 90e122e..d7a0b5d 100644
> --- a/include/linux/intel-iommu.h
> +++ b/include/linux/intel-iommu.h
> @@ -301,6 +301,8 @@ struct q_inval {
>  struct ir_table {
>  	struct irte *base;
>  	unsigned long *bitmap;
> +	void __iomem *base_old_virt;
> +	unsigned long base_old_phys;
>  };
>  #endif
>  
> @@ -342,6 +344,8 @@ struct intel_iommu {
>  
>  	/* whether translation is enabled prior to OS*/
>  	u8		pre_enabled_trans;
> +	/* whether interrupt remapping is enabled prior to OS*/
> +	u8		pre_enabled_ir;
>  
>  	void __iomem	*root_entry_old_virt; /* mapped from old root entry */
>  	unsigned long	root_entry_old_phys; /* root entry in old kernel */
> -- 
> 2.0.0-rc0
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ