From: Anthony Liguori <anthony-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
To: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Subject: Re: [kvm-ppc-devel] [PATCH 1 of 3] Move x86 kvmcallback structure to kvmctl-x86.h header
Date: Sun, 28 Oct 2007 22:50:42 -0500 [thread overview]
Message-ID: <47255892.2090308@codemonkey.ws> (raw)
In-Reply-To: <1193627660.17368.55.camel@basalt>
Hollis Blanchard wrote:
> On Sun, 2007-10-28 at 21:11 -0500, Anthony Liguori wrote:
>
>> int (*io_write)(void *opaque, int as, uint64_t addr, uint64_t data,
>> int size);
>>
>> Where as is a #define representing the address space (on x86, there is
>> the PIO and MMIO address spaces, on PPC, there is just MMIO).
>>
>
> So the implementation would look something like this:
>
> int io_write(void *opaque, int as, uint64_t addr, uint64_t data, int
> size) {
> io_handler_t cb;
>
> switch (as) {
> case MMIO:
> cb = io_table_lookup(&mmio_table, ...)
> break;
> #ifdef HAS_PIO
> case PIO:
> cb = io_table_lookup(&pio_table, ...)
> break;
> #endif
> #ifdef HAS_DCR
> case DCR:
> cb = io_table_lookup(&dcr_table, ...)
> break;
> #endif
> default:
> cb = NULL;
> }
>
> if (cb)
> return cb(...);
>
> printk("error");
> return -EINVAL;
> }
>
> Sounds fine to me.
>
You could certainly get even more clever and have the arch backend
register the appropriate tables based on the as type but that's merely
an implementation detail. The key observation, that I believe is
correct, is that all architectures have one or more IO "address spaces"
that have at max a 64-bit address space and support at max 64-bit
input/output operations. Once that assumption is made, almost all IO
code becomes common.
Regards,
Anthony Liguori
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
next prev parent reply other threads:[~2007-10-29 3:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-29 0:42 [PATCH 0 of 3] kvmctl code refactoring part 1 Jerone Young
2007-10-29 0:42 ` [PATCH 1 of 3] Move x86 kvmcallback structure to kvmctl-x86.h header Jerone Young
2007-10-29 1:13 ` [PATCH 1 of 3] Move x86 kvmcallback structure tokvmctl-x86.h header Zhang, Xiantao
[not found] ` <42DFA526FC41B1429CE7279EF83C6BDC8B51E0-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-29 2:04 ` [kvm-ppc-devel] " Hollis Blanchard
2007-10-29 2:17 ` Anthony Liguori
[not found] ` <472542B8.9070105-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-10-29 2:41 ` Zhang, Xiantao
[not found] ` <42DFA526FC41B1429CE7279EF83C6BDC8B5292-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-29 3:00 ` Hollis Blanchard
2007-10-29 3:53 ` Anthony Liguori
2007-10-29 2:41 ` [kvm-ppc-devel] [PATCH 1 of 3] Move x86kvmcallback " Zhang, Xiantao
[not found] ` <42DFA526FC41B1429CE7279EF83C6BDC8B528F-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-29 2:56 ` Hollis Blanchard
2007-10-29 2:11 ` [PATCH 1 of 3] Move x86 kvmcallback structure to kvmctl-x86.h header Anthony Liguori
[not found] ` <4725415B.4020601-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-10-29 3:14 ` [kvm-ppc-devel] " Hollis Blanchard
2007-10-29 3:50 ` Anthony Liguori [this message]
[not found] ` <47255892.2090308-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-10-29 4:14 ` Hollis Blanchard
2007-10-29 14:12 ` Anthony Liguori
2007-10-30 4:31 ` Avi Kivity
2007-10-29 0:42 ` [PATCH 2 of 3] Move kvm_context structure to kvmctl.h header Jerone Young
2007-10-29 1:28 ` [PATCH 2 of 3] Move kvm_context structure to kvmctl.hheader Zhang, Xiantao
2007-10-29 2:08 ` [PATCH 2 of 3] Move kvm_context structure to kvmctl.h header Anthony Liguori
2007-10-29 7:18 ` Izik Eidus
2007-10-29 0:42 ` [PATCH 3 of 3] Move x86 specific properties of kvm_init to own file Jerone Young
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=47255892.2090308@codemonkey.ws \
--to=anthony-rdkfgonbjusknkdkm+me6a@public.gmane.org \
--cc=hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
--cc=jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox