All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@linux.ibm.com>
To: Bharata B Rao <bharata@linux.ibm.com>, qemu-devel@nongnu.org
Cc: aneesh.kumar@linux.ibm.com, david@gibson.dropbear.id.au,
	qemu-ppc@nongnu.org, Bharata B Rao <bharata@linux.ibm.com>
Subject: Re: [RFC PATCH v0 1/2] spapr: Add H_REG_SNS hcall
Date: Fri, 06 Aug 2021 16:25:53 -0300	[thread overview]
Message-ID: <878s1etlxa.fsf@linux.ibm.com> (raw)
In-Reply-To: <20210805073228.502292-2-bharata@linux.ibm.com>

Bharata B Rao <bharata@linux.ibm.com> writes:

> Add support for H_REG_SNS hcall so that asynchronous page
> fault mechanism can be supported on PowerKVM guests.
>
> This hcall essentially issues KVM_PPC_SET_SNS to let the
> host map and pin the memory containing the Subvention
> Notification Structure. It also claims SPAPR_IRQ_SNS to
> be used as subvention notification interrupt.
>
> Note: Updates to linux-headers/linux/kvm.h are temporary
> pending headers update.
>
> Signed-off-by: Bharata B Rao <bharata@linux.ibm.com>

...

> +static target_ulong h_reg_sns(PowerPCCPU *cpu, SpaprMachineState *spapr,
> +                              target_ulong opcode, target_ulong *args)
> +{
> +    target_ulong addr = args[0];
> +    target_ulong len = args[1];
> +
> +    if (addr == -1) {
> +        return deregister_sns(cpu, spapr);
> +    }
> +
> +    /*
> +     * If SNS area is already registered, can't register again before
> +     * deregistering it first.
> +     */
> +    if (spapr->sns_addr == -1) {
> +        return H_PARAMETER;
> +    }

Don't you mean (spapr->sns_addr != -1) ?

> +
> +    if (!QEMU_IS_ALIGNED(addr, 4096)) {
> +        return H_PARAMETER;
> +    }
> +
> +    if (len < 256) {
> +        return H_P2;
> +    }
> +
> +    /* TODO: SNS area is not allowed to cross a page boundary */
> +
> +    /* KVM_PPC_SET_SNS ioctl */
> +    if (kvmppc_set_sns_reg(addr, len)) {
> +        return H_PARAMETER;
> +    }
> +
> +    /* Record SNS addr and len */
> +    spapr->sns_addr = addr;
> +    spapr->sns_len = len;
> +
> +    /* Register irq source for sending ESN notification */
> +    spapr_irq_claim(spapr, SPAPR_IRQ_SNS, false, &error_fatal);
> +    args[1] = SPAPR_IRQ_SNS; /* irq no in R5 */
> +
> +    return H_SUCCESS;
> +}


  reply	other threads:[~2021-08-06 19:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05  7:32 [RFC PATCH v0 0/2] Support for H_REG_SNS hcall Bharata B Rao
2021-08-05  7:32 ` [RFC PATCH v0 1/2] spapr: Add " Bharata B Rao
2021-08-06 19:25   ` Fabiano Rosas [this message]
2021-08-09  3:49   ` David Gibson
2021-08-11  9:26     ` Bharata B Rao
2021-08-12  1:24       ` David Gibson
2021-08-05  7:32 ` [RFC PATCH v0 2/2] ppc,spapr: Handle KVM_EXIT_ESN Bharata B Rao
2021-08-05  7:48   ` Laurent Vivier
2021-08-05  8:37     ` Bharata B Rao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878s1etlxa.fsf@linux.ibm.com \
    --to=farosas@linux.ibm.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=bharata@linux.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.