Skip to content

Commit 3eccdfa

Browse files
committed
add missing header + cleanup
1 parent cef71bb commit 3eccdfa

7 files changed

Lines changed: 38 additions & 15 deletions

File tree

so3/arch/arm64/domain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void __setup_dom_pgtable(struct domain *d, addr_t paddr_start, unsigned long map
136136
d->grant_pfn[i].free = true;
137137
}
138138

139-
/* Set IPA framebuffer starting address after the grant pfn area */
139+
/* Set staring framebuffer ipa address after the grant pfn area */
140140
d->fbdev_start_pfn = phys_to_pfn(memslot[slotID].ipa_addr + map_size + 2 * PAGE_SIZE) + NR_GRANT_PFN;
141141
fbdev_ipamap_domain(d, slotID);
142142
#endif /* CONFIG_SOO */

so3/avz/include/avz/domain.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ struct domain {
118118
/* IPA reserved page frame numbers for mapping granted pages belonging to other domains */
119119
grant_pfn_t grant_pfn[NR_GRANT_PFN];
120120

121-
/* IPA reserved starting address for framebuffer mapping */
121+
/* IPA reserved starting page frame number for framebuffer mapping */
122122
addr_t fbdev_start_pfn;
123123
#endif /* CONFIG_SOO */
124124

so3/avz/include/avz/fbdev_gnt.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* You should have received a copy of the GNU General Public License
1414
* along with this program; if not, write to the Free Software
1515
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16-
*
1716
*/
1817

1918
#ifndef FBDEV_GNT_H

so3/avz/include/avz/injector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct dom_context {
5555
/* IPA reserved page frame numbers for granted pages */
5656
grant_pfn_t grant_pfn[NR_GRANT_PFN];
5757

58-
/* IPA reserved start frame number for framebuffer */
58+
/* IPA reserved starting page frame number for framebuffer mapping */
5959
addr_t fbdev_start_pfn;
6060

6161
/* Stack frame of this domain */

so3/avz/kernel/fbdev_gnt.c

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
1+
/*
2+
* Copyright (C) 2026 Clément Dieperink <clement.dieperink@heig-vd.ch>
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License version 2 as
6+
* published by the Free Software Foundation.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program; if not, write to the Free Software
15+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16+
*/
17+
118
#include <heap.h>
219
#include <avz/fbdev_gnt.h>
320
#include <avz/domain.h>
421
#include <avz/memslot.h>
522
#include <avz/sched.h>
623

724
typedef struct {
8-
fbdev_pfns_t fbdev;
25+
fbdev_pfns_t fbdev_pfns;
926
void *fake_fbdev;
1027
int current_slotID;
1128
} fbdev_priv_t;
@@ -69,16 +86,16 @@ void fbdev_ipamap_domain(struct domain *d, int slotID)
6986
return;
7087

7188
if (slotID == priv.current_slotID)
72-
__map_fbdev(d, &priv.fbdev);
89+
__map_fbdev(d, &priv.fbdev_pfns);
7390
else
74-
__map_fake_fbdev(d, &priv.fbdev);
91+
__map_fake_fbdev(d, &priv.fbdev_pfns);
7592
}
7693

7794
void fbdev_set_pfns(fbdev_pfns_t *fbdev)
7895
{
7996
int slotID;
8097

81-
memcpy(&priv.fbdev, fbdev, sizeof(*fbdev));
98+
memcpy(&priv.fbdev_pfns, fbdev, sizeof(*fbdev));
8299

83100
/* Map framebuffer to all capsules. */
84101
for (slotID = MEMSLOT_BASE; slotID < MEMSLOT_NR; slotID++)
@@ -90,11 +107,11 @@ void fbdev_change_focus(int new_slotID)
90107
{
91108
/* Remap old capsule to fake framebuffer */
92109
if ((priv.current_slotID >= MEMSLOT_BASE) && memslot[priv.current_slotID].busy)
93-
__map_fake_fbdev(domains[priv.current_slotID], &priv.fbdev);
110+
__map_fake_fbdev(domains[priv.current_slotID], &priv.fbdev_pfns);
94111

95112
/* Map the new capsule to the framebuffer */
96113
if ((new_slotID >= MEMSLOT_BASE) && memslot[new_slotID].busy)
97-
__map_fbdev(domains[new_slotID], &priv.fbdev);
114+
__map_fbdev(domains[new_slotID], &priv.fbdev_pfns);
98115

99116
priv.current_slotID = new_slotID;
100117
}

so3/soo/drivers/vfbdevfront/vfbdev.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ typedef struct {
5050
uint32_t vres;
5151
size_t memory_size;
5252
addr_t fb_paddr;
53-
5453
} vfbdev_priv_t;
5554

5655
/* Our unique vfbdev instance. */
@@ -210,16 +209,22 @@ vdrvfront_t vfbdevdrv = { .probe = vfbdev_probe,
210209
.resume = vfbdev_resume,
211210
.connected = vfbdev_connected };
212211

212+
/* Char device associated to the framebuffer */
213+
214+
/**
215+
* Retrieve data (resolution, size, fb address) from peer and AVZ.
216+
*/
213217
static void retrieve_data(vfbdev_priv_t *priv)
214218
{
215219
vfbdev_request_t *ring_req;
216220
vfbdev_response_t *ring_rsp;
217221
avz_hyp_t hyp_args;
218222

219-
if ((priv->memory_size != 0) && (priv->fb_paddr != 0)) {
223+
/* Data have already been retrieved */
224+
if ((priv->memory_size != 0) && (priv->fb_paddr != 0))
220225
return;
221-
}
222226

227+
/* Retrieve resolution and size from peer */
223228
vdevfront_processing_begin(vfbdev_dev);
224229

225230
ring_req = vfbdev_new_ring_request(&priv->vfbdev.ring);
@@ -243,6 +248,7 @@ static void retrieve_data(vfbdev_priv_t *priv)
243248

244249
vdevfront_processing_end(vfbdev_dev);
245250

251+
/* Retrieve fb address from AVZ */
246252
hyp_args.cmd = AVZ_FBDEV_GET_ME_ADDR;
247253
avz_hypercall(&hyp_args);
248254
priv->fb_paddr = hyp_args.u.avz_fbdev_addr_args.paddr;
@@ -288,6 +294,7 @@ static int vfbdev_ioctl(int fd, unsigned long cmd, unsigned long args)
288294

289295
retrieve_data(priv);
290296

297+
/* Set returned value accordingly to the command */
291298
switch (cmd) {
292299
case IOCTL_FB_HRES:
293300
*((uint32_t *) args) = priv->hres;
@@ -303,7 +310,7 @@ static int vfbdev_ioctl(int fd, unsigned long cmd, unsigned long args)
303310

304311
default:
305312
/* Unknown command. */
306-
return -1;
313+
return -EINVAL;
307314
}
308315
}
309316

so3/soo/include/soo/uapi/soo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ typedef struct gnttab_op gnttab_op_t;
7373
void do_gnttab(gnttab_op_t *args);
7474

7575
/*
76-
* Framebuffer to set the framebuffer addresses.
76+
* Page frame number to set the framebuffer addresses.
7777
* The physical addresses may be splitted in multiple parts, which requires to have
7878
* multiple set of strating page frame and page count
7979
*/

0 commit comments

Comments
 (0)