From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Aravindh Puthiyaparambil <aravindp@cisco.com>
Cc: xen-devel@lists.xenproject.org,
Ian Jackson <ian.jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [PATCH 2/3] tools/libxc: Make the mem_access APIs generic
Date: Fri, 11 Apr 2014 10:45:45 +0100 [thread overview]
Message-ID: <5347B9C9.9050609@citrix.com> (raw)
In-Reply-To: <1397188179-14606-3-git-send-email-aravindp@cisco.com>
On 11/04/14 04:49, Aravindh Puthiyaparambil wrote:
> This patch does the following:
> 1. Add new xc_[sg]et_mem_access APIs.
> 2. Remove xc_hvm_[sg]et_mem_access() APIs.
>
> Signed-off-by: Aravindh Puthiyaparambil <aravindp@cisco.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
>
> ---
> Changes from the RFC version of the patch:
> 1. Remove xc_mem_access_memop() wrapper.
> 2. Remove xc_hvm_[sg]et_mem_access() APIs.
>
> Thanks,
> Aravindh
>
> diff --git a/tools/libxc/xc_mem_access.c b/tools/libxc/xc_mem_access.c
> index a50c145..0277ab3 100644
> --- a/tools/libxc/xc_mem_access.c
> +++ b/tools/libxc/xc_mem_access.c
> @@ -22,7 +22,7 @@
> */
>
> #include "xc_private.h"
> -
> +#include <xen/memory.h>
>
> int xc_mem_access_enable(xc_interface *xch, domid_t domain_id,
> uint32_t *port)
> @@ -47,12 +47,53 @@ int xc_mem_access_disable(xc_interface *xch, domid_t domain_id)
> NULL);
> }
>
> +
Spurious whitespace change.
> int xc_mem_access_resume(xc_interface *xch, domid_t domain_id, unsigned long gfn)
What is this gfn parameter doing? It isn't used in the hypercall.
> {
> - return xc_mem_event_memop(xch, domain_id,
> - XENMEM_access_op_resume,
> - XENMEM_access_op,
> - gfn, NULL);
> + xen_mem_access_op_t mao;
> +
> + memset(&mao, 0, sizeof(mao));
> + mao.op = XENMEM_access_op_resume;
> + mao.domid = domain_id;
Please use structure initialisation for this.
xen_mem_access_op_t mao =
{
.op = XENMEM_access_op_resume,
.domid = domain_id
};
> +
> + return do_memory_op(xch, XENMEM_access_op, &mao, sizeof(mao));
> +}
> +
> +int xc_set_mem_access(xc_interface *xch,
> + domid_t domain_id,
> + xenmem_access_t access,
> + uint64_t first_pfn,
> + uint32_t nr)
> +{
> + xen_mem_access_op_t mao;
> +
> + mao.op = XENMEM_access_op_set_access;
> + mao.domid = domain_id;
> + mao.access = access;
> + mao.pfn = first_pfn;
> + mao.nr = nr;
> +
> + return do_memory_op(xch, XENMEM_access_op, &mao, sizeof(mao));
> +}
> +
> +int xc_get_mem_access(xc_interface *xch,
> + domid_t domain_id,
> + uint64_t pfn,
> + xenmem_access_t *access)
> +{
> + xen_mem_access_op_t mao;
> + int rc;
> +
> + mao.op = XENMEM_access_op_get_access;
> + mao.domid = domain_id;
> + mao.pfn = pfn;
> +
> + rc = do_memory_op(xch, XENMEM_access_op, &mao, sizeof(mao));
> +
> + if ( !rc )
> + *access = mao.access;
Surely you should only write access back in the case of success?
~Andrew
next prev parent reply other threads:[~2014-04-11 9:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-11 3:49 [PATCH 0/3] Make mem_access APIs and hypercalls generic Aravindh Puthiyaparambil
2014-04-11 3:49 ` [PATCH 1/3] x86/mem_access: Make the mem_access ops generic Aravindh Puthiyaparambil
2014-04-11 8:52 ` Jan Beulich
2014-04-11 20:07 ` Aravindh Puthiyaparambil (aravindp)
2014-04-14 8:01 ` Jan Beulich
2014-04-11 9:35 ` Andrew Cooper
2014-04-11 9:48 ` Jan Beulich
2014-04-11 9:53 ` Andrew Cooper
2014-04-11 10:04 ` Jan Beulich
2014-04-11 3:49 ` [PATCH 2/3] tools/libxc: Make the mem_access APIs generic Aravindh Puthiyaparambil
2014-04-11 9:45 ` Andrew Cooper [this message]
2014-04-11 20:20 ` Aravindh Puthiyaparambil (aravindp)
2014-04-11 3:49 ` [PATCH 3/3] tools/xen-access: Use the new mem_access APIs Aravindh Puthiyaparambil
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=5347B9C9.9050609@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=aravindp@cisco.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xenproject.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.