Re: [kvm-devel] [PATCH 3/8] SVM: add module parameter to disable Nested Paging

Anthony Liguori
2008-01-25T21:35:31Z

Joerg Roedel wrote:
> To disable the use of the Nested Paging feature even if it is available in
> hardware this patch adds a module parameter. Nested Paging can be disabled by
> passing npt=off to the kvm_amd module.
>
> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
> ---
> arch/x86/kvm/svm.c | 8 ++++++++
> 1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 49bb57a..2e718ff 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -48,6 +48,9 @@ MODULE_LICENSE("GPL");
> #define SVM_DEATURE_SVML (1 << 2)
>
> static bool npt_enabled = false;
> +static char *npt = "on";
> +
> +module_param(npt, charp, S_IRUGO);
>

This would probably be better as an integer. Then we don't have to do
nasty things like implicitly cast a literal to a char *.

Regards,

Anthony Liguori

> static void kvm_reput_irq(struct vcpu_svm *svm);
>
> @@ -415,6 +418,11 @@ static __init int svm_hardware_setup(void)
> if (!svm_has(SVM_FEATURE_NPT))
> npt_enabled = false;
>
> + if (npt_enabled && strncmp(npt, "off", 3) == 0) {
> + printk(KERN_INFO "kvm: Nested Paging disabled\n");
> + npt_enabled = false;
> + }
> +
> if (npt_enabled)
> printk(KERN_INFO "kvm: Nested Paging enabled\n");
>
>